Future of D

Max Haughton maxhaton at gmail.com
Wed Dec 16 13:11:01 UTC 2020


On Wednesday, 16 December 2020 at 12:30:06 UTC, ddcovery wrote:
> On Wednesday, 16 December 2020 at 10:39:38 UTC, Max Haughton 
> wrote:
>> [...]
>
> As a good friend told me 20 years ago: "strong typing allows 
> you to see an application as a set of gears that fit together 
> perfectly"... with templates, you don't know the shape of the 
> gears until compiler tries to build them... this opens a lot of 
> possibilities and introduces some problems.
>
> Problem with "template constraints" is it tries to give a 
> "declarative" vision of something that is solved imperatively  
> (if you generate a "isEquatable" constraint... you must 
> generate imperative static code to check what "isEquatable" 
> means) and this is a barrier for "intelligense" systems like 
> VSCode plugins that helps developers to check it's code BEFORE 
> it is compiled.  The plugin can't determine what "isEquatable" 
> means and can't help you saying "Person class is not 
> Equatable"... a template constraint is a "custom" blackbox 
> that, semantically, doesn't associate language dependent 
> declarative concepts (like inheritance or interfaces).  Correct 
> me if I'm in an error... I am not really experienced D 
> developer.
>
> If you will work with D, you must be aware about this kind of 
> "small" barriers.

Any hypothetical IDE could just use dmd to see if the template 
fits or not. You absolutely can equate this that or the other 
because the template constraints will (99% of the time) be a 
fairly shallow tree of decisions if not flat (they are 
technically unbounded but so is everything else).


More information about the Digitalmars-d mailing list