static map as a type function
bcarneal at gmail.com
Thu Sep 24 05:45:21 UTC 2020
On Thursday, 24 September 2020 at 05:38:07 UTC, H. S. Teoh wrote:
> On Thu, Sep 24, 2020 at 03:04:46AM +0000, Stefan Koch via
> Digitalmars-d wrote:
>> On Thursday, 24 September 2020 at 02:42:00 UTC, Paul Backus
>> > On the other hand, if you can fix recursive template bloat
>> > somehow (tail-call elimination?), you get good performance
>> > *and* nice code. It's the best of both worlds.
>> good performance yes.
>> But where is the nice code, when you are confined to recursive
> What we need is imperative syntactic sugar that lowers to
> recursive templates under the hood. (After all, in theory,
> every Turing-complete language is just syntactic sugar over
> lambda calculus. :-P)
> That, plus implement template optimization schemes to lower the
> cost of recursive templates. The template analogue of
> tail-call optimization is a good first step, for example.
> Another good direction to investigate is instantiation
> elimination: i.e., defer the actual instantiation of a template
> (with its associated costs of copying the AST and substituting
> arguments, generating symbols, etc.) until it's determined to
> be necessary.
How do we get past the, rather severe, constraints Stefan
outlined wrt tail recursion?
Also, why "lower" to recursion when iteration is directly
available? Are you proposing an improvement for templates that
can not be represented in type functions?
More information about the Digitalmars-d