umka-lang
umka-lang copied to clipboard
Change qualified identifier syntax from `a.b` to `a::b`
The proposed syntax is less ambiguous, which will improve code readability.
Before:
a.b() // A function `b` from module `a` or a method `b` of variable `a`?
After:
a::b() // A function `b` from module `a`
a.b() // A method `b` of variable `a`
A realistic example with the proposed syntax:
if input::getMouseScroll().y != 0.0 {
ed.processWheel(input::getMousePos(), input::getMouseScroll().y)
}
This change is extremely easy to implement in the Umka interpreter. However, it will break a lot of existing code.
This would solve many of the problems with module naming I have, however I don't like ::, it looks a bit noisy in my opinion. If possible, I think a single : would suffice.
By the way - if this is possible to implement in a different branch to test on SaveScum - would be very cool!
@skejeton I see what you mean, but the single : already has too many roles. It may again impact code readability and even cause syntactic ambiguities, such as case a: b or a ? b : c.
That's true. :: is pretty good then.