[erlang-questions] Re: atoms used as status info, 'constants' etc

Dave Pawson dave.pawson@REDACTED
Tue Aug 18 13:18:17 CEST 2009


2009/8/18 Steve Davis <steven.charles.davis@REDACTED>:
>
> A tip on records -- as I learned recently (on this list no less), the
> most efficient way of filtering returned records would be e.g...
>
> case Value of
> #my_rec_a{} -> ...;
> #my_rec_b{} -> ...;
> _ -> {error, {invalid_type, Value}}
> end
>
> This is far more efficient that using an is_record() guard
>
> /sd

Because of the function, I'd been using case false, _
   with the function returning either the tuple or false,
which seemed somehow wrong.

I didn't like the function being context dependent.

regards


-- 
Dave Pawson
XSLT XSL-FO FAQ.
Docbook FAQ.
http://www.dpawson.co.uk


More information about the erlang-questions mailing list