[swift-evolution] define backslash '\' as a operator-head in the swift grammar

Derrick Ho wh1pch81n at gmail.com
Sun Feb 5 09:55:21 CST 2017


If the \ operator is not defined in swift, does it treat it as something
that can be operator overloaded?


On Sun, Feb 5, 2017 at 10:29 AM Nicolas Fezans via swift-evolution <
swift-evolution at swift.org> wrote:

> Dear all,
>
> This is a rather simple proposal to add '\' (backslash character) as a
> valid operator-head in the swift grammar.
>
> One argument for it, is that there exist a backslash operator in the
> MATLAB/Scilab/Octave languages. In this languages A\B solves the linear
> system A*X = B for X (or the least square problem associated to it if the
> system of equations is overdetermined). I am doing some numerical
> computation in Swift and it would be nice to be able to declare the same
> operator name for this functionality.
>
> I might have missed some arguments for not adding them, but I seems to me
> that until now the \ character is only used inside of string literals. If
> that is the case, both uses should never generate a conflict or be
> ambiguous, isn't it? (String literals keep their interpretation of \ and \
> used otherwise within the swift code will be interpreted as an operator or
> as the beginning of an operator)
>
> I am curious to see what will be the feedback on this.
>
> Nicolas
> _______________________________________________
> 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/20170205/93dc7dce/attachment.html>


More information about the swift-evolution mailing list