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

World: r3wp

[Core] Discuss core issues

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.
[unknown: 5]
23-Feb-2009
[12710]
Yeah, I agree Brian.
Henrik
23-Feb-2009
[12711]
Geomol, you should get the same results for:

either :val [true][false]
BrianH
23-Feb-2009
[12712]
Or pick [#[false] #[true]] not :val.
Henrik
23-Feb-2009
[12713]
BrianH, perhaps it's time for a little cookbook recipe on MAKE. :-)
[unknown: 5]
23-Feb-2009
[12714]
by the way,  make logic! also works with TRY
BrianH
23-Feb-2009
[12715]
The full source of TRUE? is this:
true?: func [
    "Returns true if an expression can be used as true."
    val ; Note: No [any-type!] - we want unset! to fail.
] [not not :val]
Geomol
23-Feb-2009
[12716]
Wonderful example of REBOL. :-)
BrianH
23-Feb-2009
[12717]
The note is important, because that type restriction is the main 
reason for the function, as opposed to just using NOT NOT :val.
Henrik
23-Feb-2009
[12718]
BrianH, this is in order to combat the use of unset! as inputs?
BrianH
23-Feb-2009
[12719x2]
Yes.
I've backported most of R3 to R2 (it bears repeating, because it 
was a hell of a task). 67 functions so far.
Geomol
23-Feb-2009
[12721]
Cool!
[unknown: 5]
23-Feb-2009
[12722]
So does this mean a 2.7.7?
Henrik
23-Feb-2009
[12723]
There is so much extra code done for R2, that I would be surprised 
if an R2.7.7, doesn't appear.
BrianH
23-Feb-2009
[12724]
Just do one script and you can start porting your code. And it works 
in 2.6.2.
Henrik
23-Feb-2009
[12725]
Perhaps it should be called 2.8 instead.
[unknown: 5]
23-Feb-2009
[12726x3]
Since it is all mezzanines then I don't think it should be anything 
more than offered as a mezzanine library.
Keep the current version until new natives are developed.  Otherwise 
we get nothing but mezzanine bloat with the newer version.
I think as a minimum for a new version in REBOL - it should contain 
new natives.  Maybe Carl can make some of them natives.
BrianH
23-Feb-2009
[12729]
Paul has deciphered the plan. I think it should stay a separate script. 
It breaks tons of R2 code. I expect that we won't be doing a 2.7.7 
soon, and when we do it will just be compatible bug fixes. The future 
compatibility stuff will be in the R2-Future collection.
Henrik
23-Feb-2009
[12730]
I disagree with that plan, unless there will be a method to include 
all changes with a single line of code. There are also many additions 
in VID.
BrianH
23-Feb-2009
[12731]
And no new natives in future R2 versions, just compatible fixes to 
errors in existing natives. The only changes will be to make less 
behavior cause errors. And you can include R2-Forward in one line 
of code now, in 2.6.2 even.
Henrik
23-Feb-2009
[12732]
Are the VID changes in R2-Forward?
[unknown: 5]
23-Feb-2009
[12733x2]
Brian, I suggest not waiting for Carl and just offer a library of 
 all the mezzanines that can be incorporated by just 'DOing the script 
to import them.
Carl, doesn't need to get diverted from his current R3 progress.
BrianH
23-Feb-2009
[12735]
Paul, I am doing that already. I'm just waiting for approval to release 
them as MIT licensed code.