A problem with records...

Gordon Guthrie, BTP, BT, SE gordon.guthrie@REDACTED
Fri Feb 13 18:12:19 CET 2004


Thanks to everyone for pointing out my Code Blindness... I had stared at
that for an hour and was completely unable to see the blindingly obvious...

Whenever I'm learning a new language I always spend too much time worrying
about what I don't know to remember what I know fine well...

Gordon

> -----Original Message-----
> From: Gerd Flaig [mailto:gerd@REDACTED] 
> Sent: 13 February 2004 16:37
> To: Gordon Guthrie, BTP, BT, SE
> Cc: erlang-questions@REDACTED
> Subject: Re: A problem with records...
> 
> 
> "Gordon Guthrie, BTP, BT, SE" <gordon.guthrie@REDACTED> 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                gerd@REDACTED
> 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
> 

______________________________________________________________________
Scottish Enterprise Network
http://www.scottish-enterprise.com

Address & Contact Numbers

150 Broomielaw
5 Atlantic Quay
Glasgow
G2 8LU.
Tel:  +44 (0)141 248 2700.
Fax:  +44 (0)141 221 3217

message is sent in confidence for the addressee only.
It may contain legally privileged information. The contents are not to
be disclosed to anyone other than the addressee. Unauthorised recipients
are requested to preserve this confidentiality and to advise the sender
immediately of any error in transmission.





More information about the erlang-questions mailing list