[erlang-questions] Orelse and andalso as short-hand for case
Nathaniel Waisbrot
nathaniel@REDACTED
Tue Jul 24 14:06:59 CEST 2018
> On Jul 24, 2018, at 4:00 AM, zxq9@REDACTED wrote:
>
>> On 2018年7月24日火曜日 9時19分56秒 JST Pierre Fenoll wrote:
>> I don’t understand the strong answers.
>> To me the semantics of orelse/and also are well known.
>
> "To me... well known"
>
> Says it all.
Well, it’s a pattern I’ve seen in both lisp and javascript, so I agree that it’s not a totally wild idea. A pretty wide swath of programmers should be able to recognize what’s happening.
I feel like avoiding the pattern is more on the language than the programmer, too. You don’t see this pattern in languages without side-effects and you don’t get it when both sides of && must be booleans. OTOH if the language hands me a tool and I see a convenient use for it, why should I hold back?
More information about the erlang-questions
mailing list