Hello everyone!

While still rather new Godot, I have quite often faced the problem that, while coding, screen space is rare. To save at least one glyph, I'd like to propose to have GDScript use the Unicode character → to specify the return type of a function. Currently you need to characters ->.

How do you think about this? Of course, one would be able to use both the old -> and the new → interchangeably.
How do you type this characters on your operating system? For me, an Ubuntu user, it is "AltGr + i".

Implementation would be straightforward, as you can see here: https://github.com/JanKoelzer/godot/commit/0783474fc9fbb0bce39913b1c16c1c2b88038e7f

(Are there any Scala programmers that are familiar with this? Scala uses both -> and →.)

    Dodo_87 i didnt know the AltGr key existed until just now. neat. i've never owned a keyboard or any machine that featured one.
    a couple reasons i can think of for this being a bad idea:

    • it may fragment GDscript standards, putting more stress on maintaining project specific standard to accommodate members of a developer team without a AltGr key.
    • maybe it could cause some incompatibility with someone's favorite font for one reason or another, assuming for some reason they can not use the original '->' instead.
    • there might be hardcore ASCII traditionalists raising the pitchforks and raising hell because the future is now.

    reasons i can think this is a cool idea:

    • single glyph rather than two, as you said
    • why not. i can't imagine the interpreter is going to get noticeably bloated from this feature. then again, the old adage: "death by a thousand cuts".

    Dodo_87 How do you think about this?

    Personally, I don't think it's needed.

    The screen space saving is insignificant.

    I've used many programming languages, and I can't think of any, except for APL, that uses non-ASCII characters.

    But you can submit it as a proposal.
    https://github.com/godotengine/godot-proposals

    Since you've already created a Pull Request, that might serve as the proposal.

    Dodo_87

    I think this would add complexity to not only GDScript and Godot itself, but also every third-party tool that works with gdscript (for example, text editors).

    It would also confuse newcomers because aside from you, approximately no one knows how to type the right arrow character (note that US keyboards do not have the "Alt Gr" key).

    The benefit, while nonzero, is in my opinion not worth the price.

    Edit: it would also reduce googleability when eg pasting a function signature into the search box.

    Imo, non-ASCII characters have no business being a part of any programming language's syntax.

    C uses -> since the day it was invented in 70s. They had itsy-bitsy screens back then and noone complained.

      xyz They had itsy-bitsy screens back then and noone complained.

      When I started using computers, we didn't even have screens.

      Could this not be solved with a font with ligatures (fira code, jetbrains mono, ms cascadia)?
      I believe since godot 4 the editor supports ligatures.

      Although I haven't tried it (I don't really like ligatures myself), but the font would be on your own machine, so you could use it and someone else on your team (if any) doesn't have to if he/she doesn't want it.