A problem with records...

Gerd Flaig <>
Fri Feb 13 17:37:26 CET 2004


"Gordon Guthrie, BTP, BT, SE" <> writes:

> write_sms_message(PhoneNo, Message) ->
>        Message = #sms_message_out{phonenumber = PhoneNo, message =
> Message},

Message is bound in the head. Matching the newly created record
against it fails. In your example: You match

    "esdfgjmn" = {sms_message_out,"234567","esdfgjmn"}

which is obviously a mismatch.

      Goodbyte, Gerd.

> % Bombs out here!
>        (...)
>
> and I get this message:
>
> ERROR erlang  code  crashed:
>  File: appmod:0
> Reason: {{badmatch,{sms_message_out,"234567","esdfgjmn"}},
>          [{smsout,write_sms_message,2},
>           {smsout,out,1},
>           {yaws_server,deliver_dyn_part,9},
>           {yaws_server,aloop,3},
>           {yaws_server,acceptor0,2},
>           {proc_lib,init_p,5}]}
> Req: {http_request,'POST',{abs_path,"/smsout/smsout_post"},{1,1}}

-- 
Gerd Flaig                     Technik                
Bei Schlund + Partner AG       Brauerstraße 48      D-76135 Karlsruhe
 Physics is like sex: sure, it may give some practical results,
 but that's not why we do it. -- Richard Feynman



More information about the erlang-questions mailing list