[GSoC] 'Replace Runtime Hooks with Templates' progress and update thread

Johannes Pfau nospam at example.com
Mon Jun 3 06:57:08 UTC 2019


Am Fri, 31 May 2019 07:03:56 +0000 schrieb Seb:

> 
> FWIW we have been doing this for years now (have a look at the various
> templates in object.d, e.g. __cmp or __switch) and the fact that no one
> noticed nor complained, shows that this is no concern.
> 
> tl;dr: the compiler already generates a special template everytime you
> do e.g. a switch, a cast, a comparison between classes etc.
> 
> Examples:
> - https://run.dlang.io/is/gsCSO1 - https://run.dlang.io/is/ti7rlu
> 
> There are many more.

In addition, I don't think these hooks will be 'heavy', recursive 
templates or something similar. Most of them should be quite simple.

Also, if we implement containers in phobos we also use templates. So 
there's no difference in implementing a templated array manually or 
making the compiler use templated hooks. In the end, it will have the 
same overhead (Though builtin slices are of course very commonly used).

-- 
Johannes


More information about the Digitalmars-d mailing list