Which language constructs could be done as a library if we accept some breaking changes?

Ola Fosheim Grøstad ola.fosheim.grostad at gmail.com
Mon Nov 29 12:51:47 UTC 2021


On Monday, 29 November 2021 at 12:30:42 UTC, user1234 wrote:
> static casts, devirtualization, are reasons for built-in 
> classes.

Casting is a weakness in D (in comparison to C++) so that is an 
area that needs improvement.

I am not sure if devirtualization is a good argument, as you 
should be able to have immutable pointers and "devirtualize" 
those in general.

Also, since it would be a standard library construct a good 
compiler could have a special path for those. So it should remain 
the same.


> Things for classes that can be done in the library are already 
> done there, e.g dynamic casts.

I am not so sure. If we give structs inheritance and some other 
minor adjustments then I think ```class``` could be done as a 
library construct just as well as the current builtin.




More information about the Digitalmars-d mailing list