[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: [Proposal] Overload | for booleans
- From: Sean Conner <sean@...>
- Date: Wed, 29 Jul 2015 12:11:08 -0400
It was thus said that the Great Soni L. once stated:
>
>
> On 29/07/15 11:18 AM, Dirk Laurie wrote:
> >2015-07-29 15:56 GMT+02:00 Soni L. <fakedme@gmail.com>:
> >
> >>Can we get true | false to be a thing?
> >debug.setmetatable(true,{
> > __bor = function(x,y)
> > assert (type(x)=='boolean' and type(y)=='boolean')
> > return x or y
> > end;
> > __band = function(x,y)
> > assert (type(x)=='boolean' and type(y)=='boolean')
> > return x and y
> > end;
> >})
> >
> >I like that! But why do you call it a proposal?
> >
> It would be non-short-circuiting and/or.
We already have those in the langauge, "and" and "or". The operators "&",
"|" and "~" work bitwise, not logic wise. There's a reason why C has both
"|" and "||" for "or".
-spc