A problem with records...

Bengt Kleberg bengt.kleberg@REDACTED
Fri Feb 13 17:21:17 CET 2004

Gordon Guthrie, BTP, BT, SE wrote:

>I'm having a strange problem - which might be trivial stupidity on my part
>I have defined a record as so:
>-record(sms_message_out, {phonenumber, message}).
>I try and create an instance of it with this line of code:
>write_sms_message(PhoneNo, Message) ->
>       Message = #sms_message_out{phonenumber = PhoneNo, message = Message},
>% Bombs out here!
>       (...)
>and I get this message:
>ERROR erlang  code  crashed:
> File: appmod:0
>Reason: {{badmatch,{sms_message_out,"234567","esdfgjmn"}},

you are using ''Message'' twice. both as the value for the message 
field, and as the variable holding the record.
erlang is single assignment.


This communication is confidential and intended solely for the addressee(s). Any unauthorized review, use, disclosure or distribution is prohibited. If you believe this message has been sent to you in error, please notify the sender by replying to this transmission and delete the message without disclosing it. Thank you.

E-mail including attachments is susceptible to data corruption, interruption, unauthorized amendment, tampering and viruses, and we only send and receive e-mails on the basis that we are not liable for any such corruption, interception, amendment, tampering or viruses or any consequences thereof.

More information about the erlang-questions mailing list