Strange behaviour with a record in a guard
Ulf Wiger
etxuwig@REDACTED
Mon Mar 3 10:36:12 CET 2003
On Mon, 3 Mar 2003, Bengt Kleberg wrote:
>R#r1.f1 only gets the ''right'' element from the tuple.
>
>if you want to check the record type, as well as the value
>of a field, you need to write (here ''= R'' may be omitted
>if you are not interested in the whole record):
>
>foo( #r{f1=F1} = R ) when F1 == undefined ->
> ok.
...or even
foo(#r{f1 = undefined}) ->
ok.
(You don't have to bind R in this case, but the compiler
should of course figure that out.)
--
Ulf Wiger, Senior Specialist,
/ / / Architecture & Design of Carrier-Class Software
/ / / Strategic Product & System Management
/ / / Ericsson AB, Connectivity and Control Nodes
More information about the erlang-questions
mailing list