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

David Sweeris davesweeris at mac.com
Wed Oct 19 18:10:37 CDT 2016


> On Oct 18, 2016, at 11:39 AM, Nevin Brackett-Rozinsky via swift-evolution <swift-evolution at swift.org> wrote:
> 
> It seems natural to me that currency symbols should be operators. This would allow, for example, prefix and postfix operators that take a number and return a “Currency” instance:
> 
> let inMyPocket = $20
> let lochNess = £3.50
> let twoBits = 25¢
> 
> if (inMyPocket - lochNess) > twoBits { … }
> 
> Of course, the unnamed closure parameter identifiers would conflict with that use of the dollar sign. However, I think Anton has the right idea. We already use the number sign for compiler magic, so it would make sense to call the closure parameters #0, #1, etc. In my view those even read better than what we have now.
> 
> Nevin


+1

- Dave Sweeris


More information about the swift-evolution mailing list