[erlang-questions] Record information

Thomas Lindgren thomasl_erlang@REDACTED
Wed Sep 20 11:38:17 CEST 2006


(Sorry about top-posting, I'm trying out Yahoo's new mail system)

When debugging, try rr and friends.
 
Records disappear at compile-time, but have a look at record_info/2 as a tool for rolling your own. (E.g., good old record_info(fields, my_rec) is expanded to a list of the field names of my_rec.)

(The preferrable approach would be to make records into first-class entities, but Erlang is locked into the "records = tuples" representation.)

Best,
Thomas

----- Original Message ----
From: Dmitrii Dimandt <dmitriid@REDACTED>
To: erlang-questions <erlang-questions@REDACTED>
Sent: Wednesday, September 20, 2006 9:46:35 AM
Subject: [erlang-questions] Record information

Is there a way to find information on a record? That is, what fields it contains, etc.?

That is, if I have a record like this:

-record(
        forumRequest,
        {
            userName,
            password 
        }
).

And I have A = #forumRequest(userName = "login", password = "pass").

I can find out the name of the record by doing element(1, A). Can I find out that "login" is a userName and "pass" is password? 
_______________________________________________
erlang-questions mailing list
erlang-questions@REDACTED
http://www.erlang.org/mailman/listinfo/erlang-questions




-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20060920/4951128f/attachment.htm>


More information about the erlang-questions mailing list