r3wp [groups: 83 posts: 189283]
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

World: r3wp

[!REBOL3]

Geomol
19-Apr-2011
[8042]
Atm. I prefer the same as you too (the first one), but I would suggest 
some names for the bitwise and, or and xor in the reporting of this.

I feel, the language would benefit from being a bit more strict.
Maxim
19-Apr-2011
[8043]
I'm tripped by it EVERYTIME I try to use them... none is a valid 
value for all logic control funcs.


so in over 10 years of reboling I've never been able to use them 
to control logic flow... I've used them only as bitwise ops...
Ladislav
19-Apr-2011
[8044]
Yes, Max, I guess, that you are not an exception
BrianH
19-Apr-2011
[8045]
NOT is an action that generates a logic! value. I like the current 
Lisp-like treatment, having none and false being falsey values and 
everything else being truthy values, with explicit conversions already 
available if we need them. Whatever we do, please don't have zero 
values be false without explicit conversion.
Geomol
19-Apr-2011
[8046]
I think, Carl deside these thing by trying to figure out, what makes 
most sense for a new one to programming. Or trying to make a more 
humane less computer technical language.
Maxim
19-Apr-2011
[8047]
(funny thing is that I keep forgetting this detail , and every few 
months I loose an hour trying to debug code until I remember ... 
hehe)
Gregg
19-Apr-2011
[8048x2]
I also only use them as bitwise ops, but I don't remember tripping 
over it very often. I just always use ANY and ALL. NOT was probably 
designed to be friendly, rather than pure, and I do use it a lot.
John, yes, and also supporting things people expect when coming from 
other languages.
BrianH
19-Apr-2011
[8050x2]
I come from languages that either have an explicit boolean type (Pascal-like) 
or act like REBOL (Lisp-like and Smalltalk-like).
C-like languages always trip me up - a mass of design flaws, the 
whole lot of them.
Ladislav
19-Apr-2011
[8052]
Well, but, in this case, C works better by discerning | and ||
BrianH
19-Apr-2011
[8053]
The thing is, C needs to because it doesn't have proper boolean types, 
and REBOL doesn't need to because it has the logic! type.
Geomol
19-Apr-2011
[8054]
Maybe AND, OR and XOR should only be bitwise, and then introduce 
&& and || (and maybe logical xor ^^, but just maybe).
Ladislav
19-Apr-2011
[8055]
REBOL needs to as well, since it (IF, UNLESS, EITHER, etc.) implements 
anything as logic, in fact.
BrianH
19-Apr-2011
[8056]
We can do explicit conversions, and our code becomes easier to understand 
as a result.
Maxim
19-Apr-2011
[8057]
but brian, we cannot use AND/OR for logic comparisons...  #[none] 
breaks them and none *IS* a valid conditional value.
Gregg
19-Apr-2011
[8058]
&& and ||  -- Please NOOOOOOOOO!
Geomol
19-Apr-2011
[8059]
:-D
Gregg
19-Apr-2011
[8060]
:-)
Geomol
19-Apr-2011
[8061]
Yeah, they're ugly!
Maxim
19-Apr-2011
[8062x2]
well, then we should remove   / * - + ^ too.
:-)
Gregg
19-Apr-2011
[8064]
Just vote on Ladislav's proposal, and we'll see where the results 
lead.
Geomol
19-Apr-2011
[8065x2]
But if almost nobody use OR today as logical or, but do as bitwise 
or, then we shouldn't change that.
LOR, LAND and LXOR
;p
Gregg
19-Apr-2011
[8067]
If our goal is not to break things, yes. If our goal is to clean 
things up for the long term, now is the time.
BrianH
19-Apr-2011
[8068]
None is a falsey value (NOT the value returns true), but not a false 
value. If we want to have AND, OR and XOR accept none as a false 
value, this will lead to errors being ignored unintentionally. We 
can do it, but there is a drawback. Still, I prefer that to making 
a separate set of operators for bitwise operations.
Gregg
19-Apr-2011
[8069]
Some languages do that, but usually the other way around (bit-and, 
bit-or, ...).
Geomol
19-Apr-2011
[8070]
How would you split OR into two, Gregg?
Maxim
19-Apr-2011
[8071]
I find that R3 is the right time to address these issues in the language.


R3 is already incompatible.  I don't see a reason not to clean this 
up.
Gregg
19-Apr-2011
[8072x2]
John: O and R. ;-)
It's funny, though, talking about logic values and then having "falsey" 
and "truthy" values.
Geomol
19-Apr-2011
[8074]
So it'll go like: Hey Carl, we've found this huge problem ... and 
we have no solution.

Poor Carl.
BrianH
19-Apr-2011
[8075]
I always use AND, OR and XOR in both their logical and bitwise sense. 
There is no confusion because I have to use logic! values for the 
logical behavior. This means that explicit conversions resolve the 
difference visibly.
Maxim
19-Apr-2011
[8076]
but brian, the current AND/OR/XOR  *cannot* be used for logical ops. 
 the fact that none isnt' supported is the proof that its not working. 
  bitwise ops already exist in principle with the "set" functions 
 'complement, 'union etc.
Gregg
19-Apr-2011
[8077]
Bitwise ops are computerish, logical ops are how humans think. I 
don't mind making the bitwise alternatives a little more verbose, 
or even adding a dialected BITWISE function.
BrianH
19-Apr-2011
[8078]
I use the term "conditional expressions" for the truthy/falsey expressions, 
and "logical expressions" for the logic!-only ones, not interchangeably.
Gregg
19-Apr-2011
[8079x2]
But, as Max brought up again, teh set ops are already there.
Ah, I see Brian. I'll try to remember that.
BrianH
19-Apr-2011
[8081]
TRUE? was designed to convert a conditional expression to a logical 
expression. I think it used to say that in its docstring.
Gregg
19-Apr-2011
[8082]
Anyway, vote on Ladislav's proposal. I'm a +1.
Maxim
19-Apr-2011
[8083x2]
but in real life 'TRUE? is ugly, it makes code hard to understand 
and it forces us to use parens everywhere.... oh and it slows down 
code too.

sorry, but I can't fathom this:
if ((true? value) AND (true? value2)) OR (true? value3) []

this is how it should be:
if value AND value2 OR value3 []
(I'll shut up now  ;-)
BrianH
19-Apr-2011
[8085]
There are similar conversions from is-it-zero-or-not to logical, 
from is-it-found-or-not to logical, from is-it-empty-or-not to logical. 
The conditional one isn't different. It is interesting that we don't 
have conditional AND, OR and XOR, but not really bad because of all 
the methods of explicitly converting to logical.
Ladislav
19-Apr-2011
[8086]
Brian, is it an intention, that you don't mention NOT?
BrianH
19-Apr-2011
[8087]
NOT is conditional in REBOL, so it doesn't have the same constraints 
as AND, OR and XOR which are logical or bitwise, depending on the 
types of their arguments.
onetom
19-Apr-2011
[8088]
that's an unary logic! op!; hence a black sheep :)
Ladislav
19-Apr-2011
[8089]
Nice one, Tamas!
BrianH
19-Apr-2011
[8090x2]
If you want to make logical versions of AND, OR and XOR separate 
from their bitwise versions, that doesn't make any sense - their 
types already distinguish them. If you want to change AND, OR and 
XOR to be contitional, then the additional ops can behave like the 
current ops behavior: bitwise or logical, depending on argument types.
contitional -> conditional