Would you consider using some operator other than dot (
.) for extension function calls?
I agree that extension functions are syntactically cleaner than Java static methods, but the current dot operator does not distinguish between the static dispatch of extensions and the dynamic dispatch of members, which can lead to bugs.
When calling an extension function with an implicit receiver, the new extension operator would be required as a prefix.
I don’t care what operator you use, other than that it:
- is short (preferably one character, maybe two)
- is visually distinct from
- visually separates the receiver from the member
I imagine that you could support both dot and its replacement for a while, with dot marked as deprecated. After a suitable transition period, the dot syntax could be removed.
Given the legacy code that currently uses dot, I imagine that this is probably a non-starter, but I figured I’d request it anyway…