[Date Prev][Date Next][Thread Prev][Thread Next]
- Subject: Re: [Proposal] Overload | for booleans
- From: Tim Hill <drtimhill@...>
- Date: Thu, 30 Jul 2015 12:05:14 -0700
> On Jul 29, 2015, at 11:09 AM, Soni L. <email@example.com> wrote:
>> function andx(c1, c2) return c1 and c2 end
>> function orx(c1, c2) return c1 or c2 end
>> if andx(a < 100, b > 300) then … end
>> etc. And of course easy to extend andx() and orx() to take varargs for as many expressions as you want.
> Still does branching (twice, even, because of the function call). The only difference is that now you evaluate both sides.
Your OP made no mention of branching requirements. And “the only difference” was precisely what you wanted in the OP.