[Issue 2179] import inside class works but is not in spec

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Jul 14 06:49:09 PDT 2008


http://d.puremagic.com/issues/show_bug.cgi?id=2179





------- Comment #2 from andrei at metalanguage.com  2008-07-14 08:49 -------
(In reply to comment #1)
> Wow! That's a fantastic feature.

It is pretty interesting, but it would be vastly more so if import would work
inside a template and were parameterized with the parameters of the template,
or in general if the import could be somehow parameterized. As it is, I'm not
seeing many good applications.

For example, say I want to define a module "cloneable" so I can say:

class A { import cloneable; }
class B : A { import cloneable; }

auto x = new A;
auto y = x.clone;

and so on. But in the definition of clone (inside the cloneable module) we'd
need the type of the class under construction. Guess that's where typeof(this)
would come in handy :o).


-- 



More information about the Digitalmars-d-bugs mailing list