Re: [Proposal] Overload | for booleans
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: [Proposal] Overload | for booleans
- From: Tim Hill <drtimhill@...>
- Date: 2015年7月30日 12:05:14 -0700
> On Jul 29, 2015, at 11:09 AM, Soni L. <fakedme@gmail.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.
>>
>> —Tim
>>
>>
> 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.
—Tim