[Issue 10097] __ctor, __dtor, and __postblit should no appear in user code

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu May 16 10:26:12 PDT 2013


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


Igor Stepanov <wazar.leollone at yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |wazar.leollone at yahoo.com


--- Comment #2 from Igor Stepanov <wazar.leollone at yahoo.com> 2013-05-16 10:26:11 PDT ---
(In reply to comment #1)
> However, __postblit and __dtor are already used in Phobos -
> hasElaborateCopyCoonstructor and hasElaborateDestructor.
> 
> So, we should support additional __traits to replace the existing usage:
> __traits(hasCtor, AggrType);
> __traits(hasDtor, AggrType);
> __traits(hasPostblit, AggrType);

How I can get overloads of constructor?

struct Foo
{
  this(int){}
  this(int, Foo*){}
}

Now I can write:

foreach(cur; __traits(getOverloads, Foo, "__ctor"))
{
  //do something
}

If we'll drop "__ctor" access, we can get any alternative variant to get
constructor overloads. May be access to constructor in C++ style is a better
way?

void delegate(int) ctor = &Foo.this; //this looks like function member in dot
expression.
void delegate() dtor = &Foo.~this;

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------


More information about the Digitalmars-d-bugs mailing list