Ask Your Question
0

Can I get the Member names of a Data Type?

asked Dec 23 '11

lappie gravatar image lappie
23 7

updated Dec 23 '11

I want to dynamically read out a Data Type. For example:

data X = X(str name, int val);
X x = X("x", 1);
for(_x <- x) println(_x);

This works, but is it also possible to get the member names of this datastructure (i.e. "name" and "val" for X)?

delete close flag offensive retag edit

1 Answer

Sort by ยป oldest newest most voted
1

answered Dec 26 '11

JurgenVinju gravatar image JurgenVinju flag of Netherlands
554 6 20
http://jurgen.vinju.org/

When you reify the type of X, using #X you get a full representation including all details you need. This is undocumented because we plan to change this representation soon.

link delete flag offensive edit

Comments

Thank you!

lappie (Dec 26 '11)edit

Your answer

Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
[hide preview]
Also see the Rascal Tutor.

Question tools

Follow

subscribe to rss feed

Stats

Asked: Dec 23 '11

Seen: 16 times

Last updated: Dec 26 '11