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

Daniel Duan daniel at duan.org
Fri Oct 14 18:19:05 CDT 2016


> On Oct 14, 2016, at 3:42 PM, Alex Martini via swift-evolution <swift-evolution at swift.org> wrote:
> 
>> On Oct 14, 2016, at 1:53 PM, Hooman Mehr via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>> 
>>> On Oct 14, 2016, at 1:49 PM, Daniel Duan via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>>> 
>>> Agree with Robert here. I'd rather be able to use it as part of operators. Currently the character set for operators and identifier head are mutually exclusive. So this proposal will remove that possibility. This deserves some discussion.
>>> 
>>> Daniel Duan
>>> Sent from my iPhone
>> 
> 
>> I don’t think $ will be become available to be used as an operator if we remove its identifier use. 
> 
> 
> If $ is an operator, then "$2" looks like the custom unary prefix operator "$" applied to "2".  That's a problem; it needs to be parsed as the identifier "$2" instead.
> 
> We could prevent "$" from being allowed a prefix operator.  There is precedent for the language reserving operators that would otherwise be allowed, such as postfix "?" and postfix "!".
> 

Yes, we might have to special case the parser for this. I imagine some flag such as “isParsingClosureWithoutExplicitParameter”. At least it’s not impossible 😉

> — Alex
> _______________________________________________
> swift-evolution mailing list
> swift-evolution at swift.org
> https://lists.swift.org/mailman/listinfo/swift-evolution

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20161014/342471cf/attachment.html>


More information about the swift-evolution mailing list