exported variables (was: RE: How to make GS Widgets)
Jay Nelson
jay@REDACTED
Sun Apr 18 00:39:11 CEST 2004
At 10:59 PM 4/17/04 +0200, Ulf Wiger wrote:
>>I assume you intended another clause for the non-valid
>>cases to avoid the program failing with bad_match:
>>
>>validate_color(_) ->
>> 0.
>
>Actually, no, but I was aware of the fact that by doing so,
>I changed the semantics of the code.
Oh, I was trying to reproduce the same semantics in
a different way so that the original poster could compare
them.
>I usually don't silently transform illegal input to default
>values, especially not in early versions. I find that it is
>almost always better to let the program fail in those
>cases. And function_clause is a perfectly good way to fail,
>IMHO. (:
I agree wholeheartedly with that approach.
More information about the erlang-questions
mailing list