Guards and side effects
Torbjorn Tornkvist
tobbe@REDACTED
Fri Mar 11 12:24:17 CET 2005
Thomas Johnsson XA (LN/EAB) wrote:
>(Subduing the hardcore functional programmer in me for a bit ... :-)
>
>I see really no compelling reason to prohibit side effects in guards,
>in fact there may well be sensible uses, for instance, communicating
>with another process to find out the value of the guard, consult ets tables
>or other data bases, call a memo function ....
>
>
I must say that I totally disagree here!
Side-effects must be kept as few as possible!
The hardest problem I find, when debugging
code, are those that involves side-effects, i.e
ets, process dict., message sending, etc
To open up guards to be allowed to do this
would be a nightmare.
User defined guards which is guaranteed to
be side-effect free may be ok, but then we
have the termination problem of course.
Cheers, Tobbe
More information about the erlang-questions
mailing list