On 2012-07-26 13:20, Wes wrote:
Can you do this in D? If not then what other language?

I'm pretty sure you can do all this using Ruby.

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

In general, no. But you can get a list of all members in a module or class scope. Just use __traits(allMembers, ...);

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.

Yes, if __traits doesn't work it works with .tupleof. For serialization Orange is available:

https://github.com/jacob-carlborg/orange

3. Is there any way of executing code or programs during compile
time?
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.

Classes should work. It's not possible to print to a file.

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?

I'm not sure. but you could have a look at std.concurrency. std.parallelism might be of interest as well.

This seems to good to read as well: http://www.informit.com/articles/article.aspx?p=1609144

--
/Jacob Carlborg

Reply via email to