[erlang-questions] Erlang record accessors (set/get)

Michael Truog mjtruog@REDACTED
Wed Aug 15 03:20:24 CEST 2012


It may seem a bit silly, but you could wrap element and setelement in macros that relate to the record name with short get/set names.  That would probably make it simpler for those that are addicted to get/set.

On 08/14/2012 06:10 PM, Loïc Hoguin wrote:
> Val = element(#myrec.fieldname, Rec).
> Rec2 = setelement(#myrec.fieldname, Rec, NewVal).
>
> Or something approximating that.
>
> On 08/15/2012 03:04 AM, Zabrane Mickael wrote:
>> Hi guys,
>>
>> We want to provide a simple API to one of our customers not very
>> familiar with Erlang.
>> This API involves records manipulations (set/get operations) and you
>> know what I mean.
>>
>> Before re-writing the wheel, I'd like to know is someone already used
>> "recbird" before:
>> http://blogtrader.net/blog/recbird_an_erlang_dynamic_record
>>
>> Any use case? Is it stable? Better alternatives?
>> Feedbacks welcome!
>>
>> Regards,
>> Zabrane
>>
>>
>>
>>
>> _______________________________________________
>> erlang-questions mailing list
>> erlang-questions@REDACTED
>> http://erlang.org/mailman/listinfo/erlang-questions
>>
>
>




More information about the erlang-questions mailing list