What would a minimal subset of D look like?
Mike Franklin
slavo5150 at yahoo.com
Sat Jun 22 10:10:13 UTC 2019
On Saturday, 22 June 2019 at 09:31:25 UTC, Ola Fosheim Grøstad
wrote:
> On Saturday, 22 June 2019 at 08:41:36 UTC, Mike Franklin wrote:
>> I have a few ideas for removing many features of D, preferring
>> library implementations instead, but base on your preface, I
>> think that is a different goal than what you have in mind.
>
> Btw, I'd love to hear these ideas
Interfaces are an obvious one to me. They can be implemented
using D's introspection features, and in some cases they aren't
even really necessary. See this discussion on the topic:
https://forum.dlang.org/post/qndhfzrnipsnvsstrdvg@forum.dlang.org
Classes are another. See
https://theartofmachinery.com/2018/08/13/inheritance_and_polymorphism_2.html for a very interesting implementation of class-like behavior without classes. I think D may need additional features to make it work seamlessly without language support, but you can get pretty far today.
I'm quite convinced that if we added `opImplicitCast` to the
language, we could implement `alias this` and multiple `alias
this` in the language. There was a recent discussion about that
too:
https://forum.dlang.org/post/ozdjozskgwqxfykijrsh@forum.dlang.org
I have a few others, but I think those examples illustrate the
general idea. Basically, I'd double-down on the introspection,
metaprogramming, and compile-time features of D, and then use
those features to implement whatever features one needs. Some
are concerned about falling for the Lisp curse
(http://winestockwebdesign.com/Essays/Lisp_Curse.html), but I
think it can be done tastefully to avoid that.
Mike
More information about the Digitalmars-d
mailing list