getting a whole record in a function call when only a field is be ing matched

Rachwal Waldemar-AWR001 <>
Mon Aug 30 17:23:21 CEST 2004


when compile the function as below the compiler raises 'illegal pattern'.

fun(State#state{length=unknown}) ->
    State.

Isn't it a valid construct, or it must be formulated other way?
I have to move the == check to 'when' guard, then it compiles, but looks
less nice, isn't it?

fun(State) when State#state.length==unknown ->
    State.

Thanks,
Waldemar.



More information about the erlang-questions mailing list