[swift-evolution] [Review] SE-0077 v2: Improved operator declarations

Matthew Johnson matthew at anandabits.com
Thu Jun 30 14:09:52 CDT 2016


> On Jun 30, 2016, at 1:48 PM, Xiaodi Wu <xiaodi.wu at gmail.com> wrote:
> 
> As Anton mentioned earlier, I feel the same way with respect to naming. No need to reiterate the points already made, but I do want to chime in on the topic of rarely used syntax.
> 
> While I agree of course that a cumbersome syntax for a rarely used feature is _not as bad_ as a cumbersome syntax for a common feature, all other things being equal, I think we should press for the most elegant possible syntax for all aspects of the language. It is needless, IMO, to insist that less commonly used features *ought* to be weighed down with more cumbersome spelling.

I agree.  I’m not arguing against elegant syntax here.  In fact the opposite - my preference is for the syntax I consider to be the most elegant (above and below in this case).  I’m just not willing to argue to strenuously over a less commonly used feature when the alternatives are reasonable, if slightly less elegant.


> On Thu, Jun 30, 2016 at 13:25 Matthew Johnson via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
> 
> 
> Sent from my iPad
> 
> On Jun 30, 2016, at 1:08 PM, John McCall via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
> 
> >> On Jun 30, 2016, at 2:34 AM, Anton Zhilin via swift-evolution <swift-evolution at swift.org <mailto:swift-evolution at swift.org>> wrote:
> >> https://github.com/apple/swift-evolution/blob/master/proposals <https://github.com/apple/swift-evolution/blob/master/proposals>
> >> /0077-operator-precedence.md <http://0077-operator-precedence.md/>
> >>
> >> Idea #1
> >>
> >> There is a high chance that 'higherThan'/'lowerThan' names will be
> >> chosen. I still see a problem with that. Keywords in Swift are written
> >> in full lowercase, so we should actually take 'higherthan'/'lowerthan'.
> >>
> >> But then what's the point of the preposition? It blends with
> >> higher/lower and doesn't actually add any clarity. So we should drop
> >> 'than' and have just higher/lower or above/below or succeeds/preceeds or
> >> whatever we choose, but *in a single word*.
> >
> > The preposition does add clarity.  Are the listed precedences the ones that are
> > higher than the current precedence, or are they the ones that the current
> > precedence is higher than?
> 
> I agree with that for higher and lower, but I think above and below are pretty clear (in the example just below it seems very clear (to me at least) that Multiplicative is above additive and below Exponentiative).
> 
> I think above and below are aesthetically the best here, but as has been noted this will be a rarely used feature so I won't feel bad if something else is selected,
> 
> 
> >
> > John.
> >
> >>
> >> Idea #2
> >>
> >> I personally don't like the direction in which the proposal moved (I
> >> understand the reasons). Before the first review, consensus seemed to be
> >> on this:
> >>
> >> precedence Multiplicative {
> >>   above Additive
> >>   below Exponentiative
> >> }
> >>
> >> And now:
> >>
> >> precedencegroup MultiplicativePrecedence {
> >>   higherThan: AdditivePrecedence
> >>   lowerThan: ExponentiativePrecedence
> >> }
> >>
> >> Don't you have a feeling that something cute and 'swift' was turned into
> >> a monster?
> >>
> >> At least, if we change keywords, we will get this:
> >>
> >> precedence MultiplicativePrecedence {
> >>   above: AdditivePrecedence
> >>   below: ExponentiativePrecedence
> >> }
> >>
> >> I also like in above/below that they are written with the same number of
> >> letters, meaning that they will line up nicely.
> >>
> >> _______________________________________________
> >> 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 <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 <mailto:swift-evolution at swift.org>
> https://lists.swift.org/mailman/listinfo/swift-evolution <https://lists.swift.org/mailman/listinfo/swift-evolution>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20160630/6d000804/attachment.html>


More information about the swift-evolution mailing list