[erlang-questions] record type as variable

Ulf Wiger ulf.wiger@REDACTED
Thu Aug 5 16:31:08 CEST 2010


ok@REDACTED wrote:
>> On Wed, Aug 4, 2010 at 12:05 PM, Noel Bush <noel@REDACTED> wrote:
>>> 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}.
> 
> I'm trying to think of a use case for this.

I did something along those lines in my DIAMETER stack while
at Ericsson.

http://www.erlang.org/cgi-bin/ezmlm-cgi/4/33563

Not to say that it couldn't be solved in other ways.

BR,
Ulf W
-- 
Ulf Wiger
CTO, Erlang Solutions Ltd, formerly Erlang Training & Consulting Ltd
http://www.erlang-solutions.com


More information about the erlang-questions mailing list