"let" keyword in Swift obfuscates developer intent. It should be "const".
| Originator: | brad.heintz | ||
| Number: | rdar://17156820 | Date Originated: | 04-Jun-2014 03:10 PM |
| Status: | Closed | Resolved: | No |
| Product: | Developer Tools | Product Version: | Xcode 6 Beta 1 6A215l, all OS versions |
| Classification: | Language defect | Reproducible: | Yes |
Summary: Using "let" to declare constants in Swift is broken for a multiple reasons. First, if "var" is used to declare variables - which is eminently readable and straightfoward - why is "const" not used to declare constants? Nothing about "let" as an English word says that the declared item should be immutable - it lacks simple obviousness of "var", and by analogy, "const". Second, "let" looks like a hangover from Dartmouth BASIC. I mean, come on. Steps to Reproduce: 1. Declare a constant in Swift. Expected Results: My code should be beautiful and intent-revealing, even to Swift language novices. Actual Results: My code declares constants using a keyword that is used to declare variables in BASIC, local scope in JavaScript and Haskell, identifier binding in Lisp and Scheme, and some foolishness in C# queries that I can't be bothered to learn. Swift language novices are given no cue as to my intent, and computer language polyglots have to train their brains to overload this vague keyword *yet again* in the context of Swift programming. The heat death of the universe is accelerated. Somewhere, a puppy cries bitter tears. Version: Xcode 6 Beta 1 6A215l, all OS versions Notes: Configuration:
Comments
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!
Closed on 25 June 2014 with the following comment from Apple Developer Relations
Engineering has determined that there are no plans to address this based on the following:
Respectfully, we are not going to change this.
We are now closing this bug report.
If you have questions regarding the resolution of this issue, please update your bug report with that information.
Please be sure to regularly check new Apple releases for any updates that might affect this issue.