[OT] Evolving Scala

Derek Fawcus dfawcus+dlang at employees.org
Mon Mar 24 19:46:55 UTC 2025


On Monday, 24 March 2025 at 18:27:04 UTC, Lance Bachmeier wrote:
> On Monday, 24 March 2025 at 17:14:00 UTC, Sergey wrote:
> D's unwillingness to break anything is killing the language. 
> Not even Walter can push changes through. As came up in the 
> YouTube video discussion, you can't compile .h files because a 
> few people aren't willing to change their build process to add 
> another flag. Scala won't have that problem.

Maybe change the implementation of "import" to first try a 
variation of the literal name, but with '.' encoded by some 
other, otherwise illegal character (e.g. '/').

Then one could use something like:

```D
module foo.bar;

import std.stdio;
import some-c-header/h; // Interpreted as the file 
"some-c-header.h"
```

The other alternative would be to extend the grammar such that 
the Import clause of the import declaration (spec section 5.2) 
allows a quoted module name (i.e. ModuleFullyQualified name term 
preceded and followed by a literal dounle quote character).

The latter then being interpreted as a literal file path in which 
to look.  Additionally only allow if for a limited set of literal 
extensions (initially '.c' and '.h').

Hence that would allow something like:

```D
module foo.bar;

import std.stdio;
import "some-c-header.h" // Interpreted as the file 
"some-c-header.h"
import "somedir/somefile.c"
```

As to how difficult that would be to implement in the compiler, 
I've no idea.

If I understand the current grammar, then that is currently 
illegal, and so the change would not be backward incompatible.


More information about the Digitalmars-d mailing list