[erlang-questions] Erlang Shell and record_info ??

Sanjaya Vitharana sanjaya@REDACTED
Thu Jul 26 07:04:44 CEST 2007


Hi,

Reference Manual says:
To each module using records, a pseudo function is added >> during compilation << to obtain information about records: 

record_info(fields, Record) -> [Field]
record_info(size, Record) -> Size

It's understandable, but is it not a good idea to include it to erlang shell??
thanks

Sanjaya Vitharana.

2> rl().
ok
3> 
3> A=rd(a,{b,c,d}). 
a
4> A.              
a
5> rl().           
-record(a,{b,c,d}).
ok
6> B=#a{}.
#a{b = undefined,c = undefined,d = undefined}
7> 
7> 
7> 
7> B#a.c.
undefined
8> 
8> record_info(fields,B).
** 2: illegal record info **
9> 
9> record_info(size, B).    
** 2: illegal record info **
10> 
10> C=B#a{c=rtest}.      
#a{b = undefined,c = rtest,d = undefined}
11> 
11> B#a.c.                
undefined
12> C#a.c.               
rtest
13>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20070726/bac3d252/attachment.htm>


More information about the erlang-questions mailing list