I dun a DIP, possibly the best DIP ever

H. S. Teoh hsteoh at quickfur.ath.cx
Wed Apr 22 17:43:38 UTC 2020


On Wed, Apr 22, 2020 at 05:07:58PM +0000, Stefan Koch via Digitalmars-d wrote:
> On Wednesday, 22 April 2020 at 14:02:45 UTC, Steven Schveighoffer wrote:
> > 
> > Stefan, where's that implementation of first class types for
> > CTFE-only functions you promised? ;)
> > 
> 
> As you can see I have been busy with something similar.
> ctfe-only type-access or type-functions as I call them, coming closer
> through the work that Manu and I are doing.
> 
> The type-functions I have in mind will essentially supersede  ...
> expressions.
> However ... expressions can be there in the next weeks whereas type
> functions need much heavier machinery; and therefore will take some
> more invasive changes to dmd which are unlikely to be finished soon.
[...]

This is awesome stuff.  While I'm looking forward to 1st-class types for
CTFE, I think this DIP is important for the interim, because it will
improve D's template metaprogramming, which, as some have said, is D's
crown jewel.

Without D's awesome template metaprogramming capabilities, it's a pretty
safe bet to say I wouldn't be using D today.  But the current template
expansion paradigm, which inherits from early versions of C++, simply
isn't scalable enough for non-trivial applications. This DIP, if Manu's
improvement measurements are a reliable indicator of the general case,
would make template metaprogramming *much* more attractive in D (even
more than it already is right now), and will rightly capitalize on D's
strengths to make it an even better product.  And most importantly, it
can be implemented in the near future, which is saying a lot seeing how
a lot of things in D go. :-D

And if newCTFE lands within the next year or so, the combination could
well catapult D metaprogramming to whole new levels.

*Then* when 1st class types land, it would be the next revolution. :-D


T

-- 
Why did the mathematician reinvent the square wheel?
Because he wanted to drive smoothly over an inverted catenary road.


More information about the Digitalmars-d mailing list