[erlang-questions] Reading, Learning, Confused

Hynek Vychodil vychodil.hynek@REDACTED
Mon Jul 21 13:46:51 CEST 2008


On Mon, Jul 21, 2008 at 12:24 PM, Thomas Lindgren <thomasl_erlang@REDACTED>
wrote:

>
>
>
> --- 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).
>
> Best,
> Thomas
>
>
>
> _______________________________________________
> erlang-questions mailing list
> erlang-questions@REDACTED
> http://www.erlang.org/mailman/listinfo/erlang-questions
>



-- 
--Hynek (Pichi) Vychodil
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20080721/e8b682d4/attachment.htm>


More information about the erlang-questions mailing list