Please make "say" into an alias for "var".

Originator:jb.rubin
Number:rdar://17773557 Date Originated:07/22/14
Status:Open Resolved:
Product:Developer Tools Product Version:
Classification:Enhancement Reproducible:
 
In Swift, it should be possible to declare variables with the keyword 'say', so that the ways of specifying constants and variables use the same parts of speech.

I love the way you guys resurrected "let" from Dylan. It's very clear that it means you're setting up initial conditions like you would in a mathematical proof. But it looks jarring next to "var" because one is a verb and the other is a noun or adjective. Compare:

let x = 0
var y = 1

vs...

let x = 0
say y = 1

People have used the word "say" to describe arbitrary values in thought experiments for a long time. Wikipedia dates it back to at least Galileo in 1638: "But if this is true, and if a large stone moves with a speed of, say, eight" (http://en.wikipedia.org/wiki/Thought_experiment)

Or consider one of the definitions for 'say' in the Mac OS X built-in dictionary: "used parenthetically to indicate that something is being suggested as possible or likely but not certain"

"Let X equal 0, and say y equals 1" rolls trippingly off the tongue like natural language, and uses words that clearly convey one item is a constant while the other is an arbitrary value. Whereas "Let X equal 0, and var y equals 1" only makes sense if you simply consider let and var as compiler keyword nouns with human-friendly adjectives describing them, stripping away the conventional power of "let" as a verb. That means an extra level of thought is necessary to convert those keywords back into meaning.

Comments

Only if they also make "const" an alias of "let".


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!