I have thought of a neat syntactic sugar feature I think is useful.
My thought is to add an operator (triple dots) which refers to the scope you’re in, as follows:
- …(params) will be used for a recursive call, emitting the need to rewrite the procedure name. Plus, it makes it more noticable for human eyes.
- …method(params) or …property to access the current class’s properties within it. I thoght it could be a good solution for static stuff, but Scala seems to not have built-in static definition.
The two can be distinguished, since the first case has parentheses right after the triple dots, while the second case isn’t.
As for backwards compatibility, since you can still use the long version, it won’t have any effect on existing code, and since currently it’s illegal to use it in the context seen here (triple dots may only be used right now inside function declaration, not in the body), it also won’t effect any past-written code.
What do you think about it? Do you think it can be useful for programmers?