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

World: r3wp

[Core] Discuss core issues

Geomol
23-Feb-2009
[12660x2]
Agree.
And that is what it does, right? So no problem there?
[unknown: 5]
23-Feb-2009
[12662x5]
back.  ok it only took like 35 redial attempts to get through the 
Illinois unemployment claims service this week - unbelievable.
Ok, let me check it out
Doc, I'm testing to see if a word behaves like a lit-word.
That is all my function does.
BrianH, it doesn't break.  My function is not a replacement for lit-word? 
function.
BrianH
23-Feb-2009
[12667]
Nice to hear. Interestingly enough, you can write code in R3 without 
lit-word!, get-word! or set-word! values in the code. Not R2 though.
[unknown: 5]
23-Feb-2009
[12668x2]
Doc, the reason in the example above that mine returned true was 
because it matched the error.  But that is what I want because it 
still indicates that the word behaved in a manner of a lit-word.
That is why the function is called as-lit-word.  I changed it yesterday 
to get rid of this idea that it is matching a lit-word.
BrianH
23-Feb-2009
[12670x2]
Just add one function:


quote: func [
	"Returns the value passed to it without evaluation."
	:value [any-type!]
] [
	:value
]


And you can pretend that there are no lit-word!, get-word! or set-word! 
types. It needs R3's get-word! parameter semantics though.
(sorry for the formatting of that last message)
[unknown: 5]
23-Feb-2009
[12672x2]
I'll look into that Brian.  I don't do much with R3 right now.
Since were talking about R3, do you really need a true? function?
Henrik
23-Feb-2009
[12674]
BrianH, what exactly does the :value do in function header? What 
is passed?
[unknown: 5]
23-Feb-2009
[12675]
isn't make logic! enough?
BrianH
23-Feb-2009
[12676]
Yes, you need TRUE?. Make logic! isn't the same thing.
[unknown: 5]
23-Feb-2009
[12677]
Tell me how they are different.
Henrik
23-Feb-2009
[12678]
looking at TRUE?, it seems to have been added for readability. I 
missed it sometimes in R2.
BrianH
23-Feb-2009
[12679]
>> make logic! 0
== false
>> true? 0
== true
[unknown: 5]
23-Feb-2009
[12680]
I used make logic! mostely for the TRUE? effect in R2.
BrianH
23-Feb-2009
[12681]
I use TRUE?. That was copied from R2.
[unknown: 5]
23-Feb-2009
[12682]
Yeah but I don't need True? in that case if I have make logic!
Henrik
23-Feb-2009
[12683]
BrianH, interesting. Why is there difference? (sorry for all the 
questions)
[unknown: 5]
23-Feb-2009
[12684x2]
it was copied from r2?
make logic! works like C code.
BrianH
23-Feb-2009
[12686]
I've backported most of R3 to R2.
[unknown: 5]
23-Feb-2009
[12687x2]
I guess, I see the need for true? to be extremely limited.
I only bring it up because these are things I'm concerned about in 
R3.
Henrik
23-Feb-2009
[12689]
TRUE? is very useful in case of PICK.
[unknown: 5]
23-Feb-2009
[12690]
make logic! works in pick also
BrianH
23-Feb-2009
[12691x2]
Paul, you have answered Henrik's question: make logic! works like 
C code, returning true when C would. TRUE? returns true when REBOL 
would treat it as true, not C. TRUE? is useful for AND, OR and XOR 
as well.
It was Carl's function, and he *needs* it for his code, so TRUE? 
will definitely be a mezzanine, not a library function.
Geomol
23-Feb-2009
[12693]
So in R3, zero is true and other than zero is false? I remember something 
about this. Why was it made this way?
BrianH
23-Feb-2009
[12694]
Because 0 being false only makes sense for languages without a boolean 
type (logic! in REBOL).
Henrik
23-Feb-2009
[12695]
I think TRUE? provides equivalent evaluation to TRUE or FALSE in 
the case for IF and EITHER. Often you won't need to convert some 
type to logic! in order to evaluate it with IF or EITHER, but TRUE? 
allows you to display what IF and EITHER would evaluate to and it's 
necessary for PICK. I did not know it was different from make logic!, 
but to me it this difference just makes TRUE? more valid and important 
in general.
[unknown: 5]
23-Feb-2009
[12696]
So essentially true? only reports false when it meets a an actual 
false.
Henrik
23-Feb-2009
[12697]
Also with NONE, which is where I find it to be important.
[unknown: 5]
23-Feb-2009
[12698]
correct
Henrik
23-Feb-2009
[12699]
which makes it slightly different from FOUND?
BrianH
23-Feb-2009
[12700]
Henrik: "BrianH, what exactly does the :value do in function header? 
What is passed?"


What is passed in R3 is the argument, completely unevaluated. So 
you can write this:
    set quote a get/any quote b
instead of this:
    a: :b
Geomol
23-Feb-2009
[12701]
What does this give in R3?

>> true? 1
Henrik
23-Feb-2009
[12702]
Geomol, true.
[unknown: 5]
23-Feb-2009
[12703]
John, any value passed that is not none or false will give true in 
R3 the way I understand it.
Geomol
23-Feb-2009
[12704]
Ah, then I was wrong in my assumption above.
[unknown: 5]
23-Feb-2009
[12705]
It's a departure from C way.  If you want the C way then use make 
logic!
Geomol
23-Feb-2009
[12706]
makes sense now ... I think. ;-)
Henrik
23-Feb-2009
[12707]
>> source true?
true?: make function! [[
    {Returns true! if an expression can be used as true.}
    val

][
not not :val
]
]

Sorry for crappy formatting.
[unknown: 5]
23-Feb-2009
[12708]
I agree with Brian, I think it is more aligned with how REBOL operates 
with logic.
BrianH
23-Feb-2009
[12709]
Paul, in R2 and R1 as well. The code is exactly the same.