Strange behaviour with a record in a guard

Vance Shipley <>
Mon Mar 3 18:25:07 CET 2003


Ake,

foo(R) when record(R, r1), R#r1.f1 == undefined ->

file://localhost/usr/local/lib/erlang/doc/extensions/records.html#1.6

	-Vance


On Mon, Mar 03, 2003 at 10:07:28AM +0100, Åke Johansson AI (EAB) wrote:
}  ...
}  -record(r1,{f1})
}  
}  foo(R) when R#r1.f1 == undefined ->
}  	ok.
}  ...	
}  
}  It seems like foo(R) matches any tuple of size 2 or bigger, where the
}  second element is undefined. Should not the compiler add code which 
}  checks that R is a record of the correct type?
}  
}  A sample program and sample run is found below.
}  
}  / Ake



More information about the erlang-questions mailing list