[swift-evolution] Allow ' in variable/constant names?

Nicolas Fezans nicolas.fezans at gmail.com
Tue Feb 7 14:54:04 CST 2017


So yeah, solution is to make characters easier to type, not modify the
language.

+1 to that: what about having editors which provide a graphical access to
such characters just as LaTeX editors give access to maths symbols and some
functions? The equation editors of other softwares (e.g. recent MS Word
version) also have quite usable way to provide such functionalities

-1 on the original proposal itself otherwise (sorry)


I don't think that ' is a character to consider for identifiers. I see
basically two options for such a character:
1) as delimiter (which is what is the most spread use of it, I think, in
programming languages)
2) as an operator

Actually both options might not be mutually exclusive: for instance MATLAB
uses ' both as string delimiter and as transpose postfix operator.

I would personally see the benefit of using ' as operator and could imagine
(in addition to the aforementioned MATLAB use of the postfix operator to
transpose / conjugate transpose matrices) using it as differentiation
operator on pure functions with respect to their input variables. It could
be using options to automatically make finite difference based
differentiation of any function or closure but I could even imagine it
combined with an automatic differentiation scheme at compile-time! This
would be such a great addition to a language with functional programming
capabilities for scientists and engineers.

I admit that these are heavily math/science-oriented uses, but why not?

I can't think of any wide-spread use of ' as prefix or infix operator in
other languages.

Nicolas


On Fri, Jan 13, 2017 at 6:28 PM, Georgios Moschovitis via swift-evolution <
swift-evolution at swift.org> wrote:

> Interesting background, I wasn’t aware of that.
>
> George.
>
> _______________________________________________
> 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/20170207/837cde80/attachment.html>


More information about the swift-evolution mailing list