[swift-evolution] [Review] SE-0144: Allow Single Dollar Sign as a Valid Identifier

Will Stanton willstanton1 at yahoo.com
Sat Oct 22 02:22:55 CDT 2016

On $ specifically, I found this Wikipedia article listing native operators from other languages: https://en.wikipedia.org/wiki/Operator_(computer_programming).
Haskell was listed with $ as an operator (‘Anything appearing after it will take precedence over anything that comes before’ per http://stackoverflow.com/questions/940382/haskell-difference-between-dot-and-dollar-sign)

I’m unconvinced a great case for `$` as an operator exists, so opposed to the source-breaking change, and supportive of SE-144.

Thanks for the reply and Jacob, Erica, and Xiaodi as well for drafting a broader proposal.
Were you suggesting `$(0)` as a way to initialize a type named `$` or more like `$0` as a literal?
As a decimal-number/currency-type literal operator, I remain unconvinced that justifies a source-breaking change for reasons discussed on list (which dollar? and consistency).
Addressing multiple problems seems like a good direction though (I like the list: https://github.com/jsshapiro/swift-evolution/blob/unicode-id-op/proposals/NNNN-refining-identifiers-and-operators.md#prior-discussion-threads--proposals).

A thought on the draft:
> 	• Identifiers consisting of an initial '$' (U+0024 DOLLAR SIGN) followed by one or more decimal digits ['0'...'9'] are prohibited in defining occurrences. These identifiers are reserved for use by the language as anonymous closure parameter names.  
Would it make sense/is it already the case for closure parameters to be let-like constants? (I don’t know how the compiler works it, but the error ‘Cannot assign to value: %something% is immutable’ makes me think no.) Can closure parameters be treated as automatically generated identifiers instead of a special restriction in name?

Will Stanton

> On Oct 21, 2016, at 10:48 PM, Jonathan S. Shapiro <jonathan.s.shapiro at gmail.com> wrote:
> On Fri, Oct 14, 2016 at 9:29 PM, Will Stanton via swift-evolution <swift-evolution at swift.org> wrote:
> I’m a bit curious about how `$` is/would be used as a prefix operator! Perhaps I’m not creative :-(
> Well for one thing, $(0) can be understood as a value constructor for a currency object having a value zero...

More information about the swift-evolution mailing list