[swift-evolution] [Idea] Custom keywords for operators.

Taylor Swift kelvin13ma at gmail.com
Mon Jul 31 19:29:32 CDT 2017


On Mon, Jul 31, 2017 at 7:20 PM, David Sweeris <davesweeris at mac.com> wrote:

>
> > On Jul 31, 2017, at 3:59 PM, Taylor Swift via swift-evolution <
> swift-evolution at swift.org> wrote:
> >
> > I’m gonna come out and say I’m not a fan of this at all. I’m already
> pretty suspicious of operator overloading, and I think supporting this
> would make Swift code much more difficult to read. Also, while for some
> reason everyone ignores this, this kind of syntax is almost impossible for
> text editors to highlight, which I think is an important consideration for
> any changes to language syntax.
>
> As I said in some other thread, I'm not convinced we should be making
> design decisions based on potential aesthetic bugs in text editors. Not
> because syntax highlighting isn't important for non Xcode users, but
> because they're just that: bugs... Presumably they'll get fixed in the next
> release of whatever does your syntax highlighting.
>

It’s not that I’m against new syntax, language packages can always be
updated. But when it comes to introducing syntax that you cannot update a
language package to support, I think that’s something to avoid. Most text
editors parse source code using regular expressions. That’s not just a
technical limitation, it’s also good sense. You don’t want to have to
search for a keyword declaration that potentially lives in another file, or
even another module, if it exists, just to know whether a word is an
identifier or an operator.


>
> Does anyone know if the new technologies that Xcode ties into are specific
> to swiftc/clang, or is LLVM in general now able to integrate with text
> editors for syntax highlighting, etc? This might be a hard sell if only
> works with Swift, but if it's a new service that LLVM provides for any
> language (or even just Swift & the Cs, given the laters' popularity), all
> your text editor's vendor has do is support that and it'll automatically
> get correct syntax highlighting info straight from the compiler itself.
>
> - Dave Sweeris


This idea came up in the past <https://github.com/atom/atom/issues/8669>
with Swift support in the Atom editor and it never went anywhere. Just
because one single proprietary source editor supports the proposed syntax
is not evidence that it would be widely supported. Considering Atom is one
of the more progressive editors out there, if they weren’t going to support
SourceKit integration I doubt the many other editors out there would. Mind
you gedit literally *just* got basic regex Swift highlighting support about
a month ago.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.swift.org/pipermail/swift-evolution/attachments/20170731/190cb4cf/attachment.html>


More information about the swift-evolution mailing list