On type functions

Manu turkeyman at gmail.com
Mon May 4 04:16:52 UTC 2020


On Sun, May 3, 2020 at 9:10 PM Panke via Digitalmars-d <
digitalmars-d at puremagic.com> wrote:

> On Sunday, 3 May 2020 at 10:52:37 UTC, Stefan Koch wrote:
> >
> > If there are any other open questions about how this is
> > supposed to work I am happy to answer them.
>
> I think type functions are important work.
>
> What operations are available on types? Can I do something like
> this:
>
> ---
> TStruct structFromSpec(string spec)
> {
>      TStruct result;
>      for (field; parseFields(spec))
>      {
>          result.addField(field.name, field.type)?
>      }
>      return result;
> }
> ---
>
> or how is it supposed to look? I'd figure compile times will be
> improved greatly at first and suffer heavily afterwards, because
> everyone will be using this awesome feature to do even more at
> compile time.
>
> Is there any plan to cache the results of type functions? What do
> we need to incorporate into the design to make it cacheable?
>
>
> I am eager to see this in action.
>

Doing "even more" at compile time is not a bad thing, and should actually
be perfectly natural.
The problem we have today is that recursive instantiation is often N^2, and
also very expensive in terms of symbol mangling, and populating the symbol
tables with gigabytes of junk.

If you remove the N^2-ness and also remove gigabytes of rubbish from the
compiler, you can do immensely more then we do now, and still not
experience comparable slow-ness to what we experience today.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20200504/d9cd936b/attachment.htm>


More information about the Digitalmars-d mailing list