does D already have too many language features ?

jmh530 john.michael.hall at gmail.com
Mon Apr 8 18:45:24 UTC 2019


On Monday, 8 April 2019 at 17:20:00 UTC, Manu wrote:
> 
>
> That would eject me from the boat.
> That said, I think classes as a discreet feature might be 
> unnecessary.
> classes could be removed if the language were able to express 
> class
> semantics in a struct as a library. That's tricky as hell 
> without ANY
> compiler support though. I can't imagine a way to add concepts 
> like
> `virtual` and `override` as library. It would probably require 
> AST
> macros.

I think some people have discussed on the forums before about how 
AST macros could be used to implement this (after all, C++'s 
metaclass proposal could probably also be implemented with AST 
macros). However, even if AST macros might be used to implement 
OOP as a library, I think the burden of proof is on those in 
favor of library solutions to show that they can get similar 
performance, both run-time and compile-time, and quality of error 
messages as the current implementation.

Another option would be to keep classes, but implement other OOP 
features like interface
and abstract as libraries, with AST macros if needed. Perhaps 
less disruption.


More information about the Digitalmars-d mailing list