moving general-purpose functions from httpd_util to stdlib
Robert Virding
robert.virding@REDACTED
Wed Apr 16 23:29:02 CEST 2003
Definitely the closed case. The extra cost is negligible and the meaning
much clearer, especially if the test is not so obviously a "safe" boolean.
Robert
----- Original Message -----
From: "Chris Pressey" <cpressey@REDACTED>
To: "Robert Virding" <robert.virding@REDACTED>
Cc: <eleberg@REDACTED>; <erlang-questions@REDACTED>
Sent: Tuesday, April 15, 2003 8:06 PM
Subject: Re: moving general-purpose functions from httpd_util to stdlib
> Thanks, everybody.
>
> But I have to apologize for that bad example. The 'error' is a red
> herring that clouds the issue. The question is more about whether it is
> wiser, in general, to write "open" or "closed" cases.
>
> A (possibly) better example:
>
> % "open" case
> case A > B of
> true ->
> 41;
> _ ->
> 42
> end
>
> % "closed" case
> case A > B of
> true ->
> 41;
> false ->
> 42
> end
>
> % "let-it-crash" style - seems almost like a different problem
> case catch begin
> true = A > B,
> 41
> end of
> {'EXIT', Reason} ->
> 42;
> Result ->
> Result
> end
>
> -Chris
More information about the erlang-questions
mailing list