record type as variable

Noel Bush <>
Wed Aug 4 19:05:15 CEST 2010


Is there any way to specify the type of a record using a variable? I
want to be able to do this sort of thing:

create(Type, Name) ->
    #Type{name = Name}.

(Obviously, I'm responsible for making sure that Type corresponds to a
record type, that any record type has a name field, etc.) It doesn't
seem like that much of a pain to write a few record-handling functions
that would allow me to do this, but it would be great to find out that
someone's already done the work.

Thanks,
Noel


More information about the erlang-questions mailing list