www.digitalmars.com         C & C++   DMDScript  
Archives

D Programming
digitalmars.D
digitalmars.D.bugs
digitalmars.D.dtl
digitalmars.D.ide
digitalmars.D.dwt
digitalmars.D.announce
digitalmars.D.learn
digitalmars.D.debugger
D.gnu
D

C/C++ Programming
c++
c++.announce
c++.atl
c++.beta
c++.chat
c++.command-line
c++.dos
c++.dos.16-bits
c++.dos.32-bits
c++.idde
c++.mfc
c++.rtl
c++.stl
c++.stl.hp
c++.stl.port
c++.stl.sgi
c++.stlsoft
c++.windows
c++.windows.16-bits
c++.windows.32-bits
c++.wxwindows

digitalmars.empire
digitalmars.DMDScript
electronics


digitalmars.D.learn - why __traits not in trait module and not name it trait

reply Sam Hu <samhudotsamhu gmail.com> writes:
Yes,__traits did not stole my girl friend,but isn't better to name it trait?
And I have thought I can find it in trait moudle but I was wrong.
Jun 24 2009
parent reply Daniel Keep <daniel.keep.lists gmail.com> writes:
Sam Hu wrote:
 Yes,__traits did not stole my girl friend,but isn't better to name it trait?
And I have thought I can find it in trait moudle but I was wrong.

It's not in a module because it's a keyword. You don't find "function" defined in any library. As for being called __traits instead of traits, I suspect that's for at least one of two reasons: 1. so it won't invalidate existing code that uses the identifier "traits", and/or 2. because it's not something regular programmers should have to use; it should be used to build a higher-level API using templates.
Jun 24 2009
next sibling parent Sam Hu <samhudotsamhu gmail.com> writes:
Thank you so much for your help!

Just feel not so good that there are so many "__" in the code when making use
of reflection from __traits.

Regards,
Sam
Jun 24 2009
prev sibling parent bearophile <bearophileHUGS lycos.com> writes:
Daniel Keep:
 2. because it's not something regular programmers should have to use; it
 should be used to build a higher-level API using templates.

Maybe Java programmers. D programmers need that functionality often. Bye, bearophile
Jun 25 2009