[swift-evolution] [Review] SE-0022: Referencing the Objective-C selector of a method

Douglas Gregor dgregor at apple.com
Thu Jan 21 23:47:19 CST 2016


> On Jan 21, 2016, at 9:25 PM, Erica Sadun via swift-evolution <swift-evolution at swift.org> wrote:
> 
> Okay, you know this was coming: let's Groff this thing.
> 
> How about #(line) where you can decouple the specific compiler implementation bits from the keyword bits without hardcoding support, enabling implementation of, for example, #(runcible) for future Swift compiler substitution logic.

The compiler can parse 

	#identifier

or

	#identifier(balanaced-set-of-tokens)

without knowing what the identifier is going to be. One could imagine that as a way to, say, expand a macro in some as-yet-undesigned macro system. #available, #selector, #line, #column, etc. are merely short-term hacks until such a macro system gets designed.

I’m supportive of sharpening the boa constrictors to #line, #column, etc., but I’m too design-fatigued to write it up. Any takers?

	- Doug

> 
> -- E
> 
>> On Jan 21, 2016, at 10:19 PM, Chris Lattner <clattner at apple.com <mailto:clattner at apple.com>> wrote:
>> 
>> 
>>> On Jan 21, 2016, at 9:17 PM, Erica Sadun <erica at ericasadun.com <mailto:erica at ericasadun.com>> wrote:
>>> 
>>> +1 to setting __LINE__ (and friends) free of their unsightly upper snake case. They look like boa constrictors trying to digest a fully-swallowed keyword.
>> 
>> Yeah, I totally agree.  Actually, the proper spelling would simply be #line - after all, there’d be no need to shout any more…
>> 
>> -Chris
>> 
>> 
>>> 
>>> -- E
>>> 
>>>> On Jan 21, 2016, at 10:04 PM, Chris Lattner via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>>>> 
>>>> 
>>>>> On Jan 21, 2016, at 4:13 PM, Jordan Rose via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
>>>>> 
>>>>>>> 
>>>>>>> I think that #selector is workable and fits into the model - it would be simple to implement and not cause unnecessary complexity in the implementation.
>>>>>>> 
>>>>>>> That said, I’m in favor of x.selector, or #selector(x).  The former seems more syntactically elegant if it is practical.
>>>>>> 
>>>>>> The latter gives us easy extensions like
>>>>>> 
>>>>>> 	#selector(getter: MyType.property)
>>>>>> 	#selector(setter: MyType.property)
>>>>>> 
>>>>>> #selector is sorta growing on me.
>>>>> 
>>>>> +1 from me. At this point in Swift's evolution, the # feels like "invoke compiler substitution logic here”.
>>>> 
>>>> I agree.  Along those lines, we could consider renaming __LINE__ and friends to #LINE
>>>> 
>>>> -Chris
>>>> _______________________________________________
>>>> swift-evolution mailing list
>>>> swift-evolution at swift.org <mailto:swift-evolution at swift.org>
>>>> https://lists.swift.org/mailman/listinfo/swift-evolution <https://lists.swift.org/mailman/listinfo/swift-evolution>
>>> 
>> 
> 
> _______________________________________________
> 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/20160121/31aaebd6/attachment.html>


More information about the swift-evolution mailing list