[erlang-questions] Reading, Learning, Confused
Mon Jul 21 13:46:51 CEST 2008
On Mon, Jul 21, 2008 at 12:24 PM, Thomas Lindgren <thomasl_erlang@REDACTED>
> --- On Mon, 7/21/08, Richard A. O'Keefe <ok@REDACTED> wrote:
> > Bottom line:
> > DON'T use 'or' or 'and' ANYWHERE.
> > DON'T use 'orelse' or 'andalso' in
> > guards
> > but instead stick to ';' and ','.
> I normally agree with those recommendations, but with a couple of caveats:
> 1. You can't nest ';', but you can nest orelse. This can be useful for
> macros and suchlike.
> 2. I seem to recall that ';' is implemented by duplicating the clauses,
> while andalso/orelse is not. If so, andalso/orelse _may_ yield somewhat more
> compact code.
3. Code using 'andalso' and 'orelse' can be cut paste copied as expression
anywhere but ',' and ';' can be used only in guards (function, case, if).
> Both of these properties are basically accidents of history (ie, hacks that
> have been cast in stone).
> erlang-questions mailing list
--Hynek (Pichi) Vychodil
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the erlang-questions