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


Maxim Fomin <[email protected]> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |[email protected]


--- Comment #3 from Maxim Fomin <[email protected]> 2013-05-16 11:27:46 PDT 
---
(In reply to comment #0)
> This code:
> 
> struct S {
>     this(int) {}
>     this(this) {}
>     ~this() {}
> }
> pragma(msg, __traits(allMembers, S));
> 
> Would print:
> tuple("__ctor", "__postblit", "__dtor", "__cpctor", "opAssign")
> 
> But, the identifiers which starts with double underscore are internal names.
> I think __traits(allMembers) should not show such internal names.

I think there are some reasons that they should be listed in allMembers
(because they are members). However idea with special traits for ctors, dtors
and postblit is even better. Anyway this is a minor issue.

But the problem is bigger. Dmd internally generates hoards of symbols and does
not stop them to be accessed. They can be divided into two categories:
1) ctors, dtors, postblits, fielddtros, fieldpostblits, shared ctors, unittests
and others which can be accessed both by internal name and by linking.
2) variables which can be accessed only by internal name.

For example, this program compiles and runs:

extern(C) int printf(const char*,...);

void main()
{
   foreach (i; 0..2)
   {
      if (__key5 == 1)
         __limit6 += 3;
      printf("%d\n", i);
   }
}

and breaks idea about behavior of foreach range. This is just accepts-invalid.

So, what you effectively propose is to take three items of first group and make
them inaccessible in some circumstances. I think other holes should be closed
too.

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

Reply via email to