www.digitalmars.com         C & C++   DMDScript  

D - Can you do this in D? If not then what other language?

reply "Wes" <ffhighwind hotmail.com> writes:
Can you do this in D? If not then what other language?

1. Can you get a list of all classes and variables in the current 
scope e.g. __traits()?

2. Can you statically iterate over every field of a class?
It seems like the only returns are string lists from __traits(). 
I basically am interested in being able to generate a 
PrettyPrint/Serializable/Hash template without passing in every 
single field.

3. Is there any way of executing code or programs during compile 
I've seen an example of CTFE (Compile Time Function Evaluation), 
although I'm unsure if this works for stuff like classes. 
However, I am considering more advanced execution (not constants) 
such as printing to a file during compiling for stuff like how 
long compiling a certain function/template takes.

4. Is there anything like Go/Erlang channels? (synchronous queues)
I assume that synchronized blocks with a shared global dynamic 
array would be the solution without the special syntax sugar?

5. Why not support other operators like $, #, and  ?
This is more of a rhetorical... as I know the language doesn't 
need them, nor would I know if they would be binary/unary 
prefix/etc or the precedence... although they would be nice to 
have. Specifically I'd like $prefix to be stringification.
Jul 26 2012
parent "Wes" <ffhighwind hotmail.com> writes:
Moved my post to the "actual" forum... send your reply there.
http://forum.dlang.org/thread/pghyphuyefebnfrzkdjj forum.dlang.org#post-pghyphuyefebnfrzkdjj:40forum.dlang.org
Jul 26 2012