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

Alexandru Ermicioi alexandru.ermicioi at gmail.com
Sun Nov 28 21:56:37 UTC 2021


On Sunday, 28 November 2021 at 20:47:28 UTC, Ola Fosheim Grøstad 
wrote:
> If there was a majority in favour of D3, with breaking changes, 
> and a strong focus on meta-programming, then it would make a 
> lot of sense to streamline the language.
>
> What would that consist of? I would say:
>
> 1. Figuring out what the missing bits for meta-programming are.
>
> 2. Taking out all language constructs that can be implemented 
> as a library feature.
>
> 3. Add some syntactical sugar where necessary (mapping to 
> library features).
>
> Which features that are currently in the language could with 
> some adjustments be done as a library feature?
>
> Hashtable?
>
> Dynamic array?
>
> Slices?

I think these could've been implemented as structs, then the only 
change would be to rewrite any T[] to Array!T, given structs are 
able completely replicate their behavior.

This in turn can lessen the coupling between compiler and the 
implementation, and allow other potential implementations. For 
example using custom gc, or making them rc counted (given rc 
problems are solved), or having a backing store location 
implementation hidden by interface allowing you to use different 
storing methods. There might be some compatibility problems 
though.

I.e. you won't have any breakage here, though you might consider 
removing them as language constructs, and have the said breakage.

Best regards,
Alexandru.




More information about the Digitalmars-d mailing list