Pre-typer syntactic plugins in Scala 3?

Btw, is Ammonite’s import $ivy. now considered a “dialect” which needs to get burned? “Vanilla Scala” won’t compile that…

https://ammonite.io/#import$ivy

I hope all the given examples show now clearly that this “no language extension” policy is complete nonsense. Scala lives by its various extensions! (Which most of the time aren’t proper dialects anyway). If you take this away you have at best Kotlin. Why would anybody use Scala then?

Edit: I just realized that Kotlin has actually quite some dialects. They use compiler extensions excessively, and this is considered “a good thing”. So once more: The issue is again just marketing!

Yes, tooling is an extremely important part of the picture. Nobody claimed otherwise. But this should go hand in hand with powerful abilities for language extensions on all kinds of axes. So the key here would be to think about some language extension mechanisms that are tooling friendly, and actually properly integrated into tooling before prime time.

A good and stable officially supported pre-typer plugin API seems to be the right thing. (The alternative is of course just to hack something. Nothing holds one back to manipulate the part of the compiler that disallows currently pre-typer plugins. The JVM is a dynamic runtime, you can do all kinds of hacks, up to runtime bytecode rewriting. Should there be no official way people will just find workarounds, because people don’t like arbitrary limitations. Especially if those are there only for ideological reasons without any true technical necessity.)

In the end people want power, not limitations. @lihaoyi is just right about that. But limiting power where needed is of course also a valid requirement. I understand this, and that’s why I’ve proposed a kind of relief to this situation in the other thread.

The real problem are arbitrary extensions that aren’t properly integrated so people need to fall back to some kind of “hack”. So Scala should always look to pick those up when the time is ripe. Kind projector is a great example of how this can work out nicely! This never would have happened if things would have been outright limited form the get go.

1 Like