Pre SIP: scala-cli as new scala command

A lot of these arguments should ideally have been brought up earlier in the process. In fact, the main reason this surfaces again is because of one major observation: the current syntax was designed with the expectation that it would not be comments, but rather actual Scala syntax. For example,

//> using scala "3.2.2"

@main def hello(): Unit =
  println("hello")

was initially meant to become

using scala "3.2.2"

@main def hello(): Unit =
  println("hello")

The commented form was designed to be a transition stop gap to allow experimentation without breaking IDEs while doing so.

That assumption led to at least two decisions:

  • Reusing an existing keyword, namely using (although implicit was decomposed into given, using and Conversion, somehow the winning argument was to merge using with config :man_shrugging: )
  • Use the syntax of Scala literals for the values of settings, for example using scala "3.2.2" instead of using scala 3.2.2.

The second point precluded reusing existing config languages like YAML. We wanted Scala syntax as a design goal.

That said, eventually the majority opinion was to keep using the comment-based syntax, rather than integrating the config into the language. But at that time, we did not reconsider the two points above, although their driving motivation had disappeared.

This brings us to this discussion, where we have, perhaps belatedly, realized that we should at least reconsider the syntax choice.


After this recontextualization, here is my opinion. Given that we are not bound by following the spirit of the Scala syntax anymore, I think the two points above have become moot.

I think we should explicitly avoid the using keyword (in fact I had already argued that before, without success) so that searchability gets improved, both for the config keyword and the contextual abstraction keyword. implicit was decomposed into 2 keywords and 1 named trait, although it was very defensible to say “but these three concepts are about terms that the compiler implicitly fill in for us”. In order to be consistent with the reasoning (and complaints) that led to that decision, we should also separate the config keyword from the contextual abstraction keyword.

Regarding the syntax, I had not in fact (re-)thought about using existing config formats like YAML before this discussion. The comments made before mine make a good case for reusing something that exists.

11 Likes