Thank you, everyone, for the comments and suggestions.
After many discussions, I get convinced to stick to the comment syntax for now. Usability gains with dropping special syntax for comments are small, and there is non-zero potential to confuse users. It also seems that early adopters of Scala CLI are content with comment-based syntax.
I think this concludes the following points: Re-purposing the using keyword vs introducing a new keyword
, Syntax does not look like usual Scala
, Alternative Solution: Comments
.
Alternative Solution: Language Imports
We haven’t picked imports since the scope of the import is limited to a single file but using directives applies configuration to the whole compilation unit (e.g. compiler options). I think overloading imports with meanings (import members to the scope and import settings to the build) is not a good direction.
Alternative Solution: Annotations
We were considering annotation initially, but there is a critical semantic problem with annotations: annotation provides metadata for something (a class, method, parameter etc.). In the case of Using Directives, the metadata is provided to the whole compilation unit, a concept that is not materialized within a source file, so there is nothing to annotate. Moreover, similarly to imports, we would use the same constructs and syntax for 2 different purposes and this is something that I think we should avoid.