rr(Mod) in the shell

Thomas Lindgren thomasl_erlang@REDACTED
Thu Sep 8 00:32:26 CEST 2005



--- Claes Wikstom <klacke@REDACTED> wrote:

> orbitz@REDACTED wrote:
> > Does it still work if you have the same record
> name but different  
> > definitions for different modules?  
> 
> No,
> 
> Needs some though ....

This is fairly common; in R10B7, 126 modules define a
record named 'state' for example.

I'd recommend implementing first class records to get
this right. However, the original definition of
records makes painfully clear that records are only
syntactic sugar for macro expansion to tuples, so
backwards compatibility may be nontrivial.

Another option might be multiple record views of
tuples. If a tuple looks like {rec_tag, X1,...,Xn},
then any definitions of a record named rec_tag with
precisely n fields can be used to print it. Deciding
which printer is correct is left to the implementor. 

(I can think of one simple way to decide: add a hidden
field to each record to indicate the UNIQUE name of
the record and use that, rather than the non-unique
record name, to select the printing function. Solving
the other problems with this approach is left as an
exercise.)

Best,
Thomas



__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around 
http://mail.yahoo.com 



More information about the erlang-questions mailing list