[swift-evolution] [Returned for revision] SE-0077: Improved operator declarations

L. Mihalkovic laurent.mihalkovic at gmail.com
Wed Jun 29 00:13:24 CDT 2016


Regards
LM
(From mobile)

On Jun 28, 2016, at 6:32 PM, John McCall <rjmccall at apple.com> wrote:

>> On Jun 28, 2016, at 9:12 AM, L. Mihalkovic <laurent.mihalkovic at gmail.com> wrote:
>> 
>> Question inline
>> Regards
>> LM
>> (From mobile)
>> On Jun 28, 2016, at 1:01 AM, John McCall via swift-evolution <swift-evolution at swift.org> wrote:
>> 
>>>> On Jun 25, 2016, at 10:57 AM, Anton Zhilin via swift-evolution <swift-evolution at swift.org> wrote:
>>>> I replaced `precedencegroup` with `precedence` and added `Precedence` 
>>>> suffix to all precedence group names. See:
>>>> 
>>>> https://github.com/Anton3/swift-evolution/blob/fix-operator-
>>>> precedence/proposals/0077-operator-precedence.md
>>>> 
>>>> My feelings:
>>>> 1. `precedencegroup` describes what it declares more precisely
>>>> 2. `precedence` is shorter (partially compensating for longer names)
>>>> 3. `precedence` can be correctly interpreted as "precedence level"
>>>> 4. `precedence` looks nicer overall
>>> 
>>> Keep in mind that this is a pretty marginal feature.  I'm not sure "precedence" is a reasonable enough thing to take as a keyword for it.
>>> 
>>> John.
>> 
>> Would a meta-circular definition be possible (proposed a version using enums)? I remember a mail from chris about moving certain things currently backed into the compiler towards the stdlib, is this one a possible candidate...
> 
> This is already strongly library-determined.  The library defines what operators exist and defines their precedence w.r.t. each other and a small number of built-in operators.  Operator precedence has to be communicated to the compiler somehow in order to parse code.  This proposal is just deciding the syntax of that communication.
> 
> I see no reason to use a more conceptually complex approach when a simple declaration will do.

Np... I thought that enums instead of keywords would also make them naturally discoverable when a reflection API gets created. Felt odd to see so many new language keywd assigned to a single feature. 


More information about the swift-evolution mailing list