druntime, templates and traits

Jacob Carlborg doob at me.com
Fri Sep 13 05:35:20 PDT 2013


On 2013-09-13 12:26, monarch_dodra wrote:

> I had started toying around with this, and the main and immediate
> challenge I ran into is the integration of templates. The 2 issues are:
> 1. All templates must be in object.d, or the compiler won't see it.

Do you know why that is? Can they be put in a separate module but 
imported by object.d?

> 2. A simple (and needed) trait like "hasElaborateCopyConstructor"
> requires a good third of both "typetuple.d" and "traits.d".
> "functionAttributes" is pretty simple though (I think).

Can't we move some of the traits to druntime? std.traits would publicly 
import the ones which were moved.

> So the two challenges are:
> 1. If we integrate a large amount of template code, where would it go?

It depends on where it needs to be used. Some suggestions:

* core.traits|typetuple
* rt.util.traits|typetuple

> 2. How will we deal with not having massive code duplication?

Move to druntime? Phobos already depends on it.

-- 
/Jacob Carlborg


More information about the Digitalmars-d mailing list