REPL semantics

Luís Marques luis at luismarques.eu
Thu Jul 12 19:45:27 UTC 2018


On Thursday, 12 July 2018 at 19:07:15 UTC, Luís Marques wrote:
> Assuming implementation complexity is not an issue, what do you 
> feel is the more natural semantics for a REPL? Should foo now 
> call bar(int), or should it still call bar(long)? (feel free to 
> generalize the issue)

BTW, this succeeds:

     long foo(long x) { return x; }
     enum x = foo(42);
     mixin("int foo(int x) { return x-1; }");
     enum y = foo(7);
     static assert(x == 42);
     static assert(y == 6);

...but is it guaranteed by the spec? Alternatives: 1) 
implementation-defined ordering (of the mixin and the enums), 
possibly different than the existing frontend; 2) 
non-deterministic ordering, can change from one compiler run to 
another.


More information about the Digitalmars-d mailing list