Open jpmhouston opened 10 years ago
I see this is still on here. Forget about my original syntax idea, I had forgot about eero's removal of @ signs in general. How about '|isFinished|'
?
I think your original idea of @|isFinished|
is still pretty good, even though eero does get rid of most @s. After all, the ObjC box operator @()
is still supported. The problem with '|isFinished|'
is that it is the same as the NSString literal for "|isFinished|" (I'm reading your snippet as being enclosed in single quotes).
Another idea might be to extend the box operator to recognize selectors -- e.g. @(|isFinished|)
. Yet another could be to extend the cast-like box operator to recognize (String)|isFinished|
. Or maybe both would be most appropriate, for consistency.
Right now, you can use StringFromSelector(|isFinished|)
(taking advantage of prefix lookups), which isn't too bad. Sill, it might be worth exploring some of these ideas (or others).
Saw this tip in the recent NSHipster, which I think is good idea although it's crying out for a nicer syntax:
I'm suggesting that the syntax
@|isFinished|
would fit nicely into eero. Forgive me if this is already in the language.Also, even though there may be less call for using
NSStringFromProtocol
, why not use similar syntax on protocol literals, even if only for completeness?