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

World: r3wp

[Core] Discuss core issues

Sunanda
20-Nov-2006
[6280]
Quick hack, Graham:
test: make object! [ a: b: none  c: make object! [ d: none]]
obj: make first reduce load mold test [ c/d: "testing"]
[unknown: 10]
20-Nov-2006
[6281]
x: [ 2 4 6 ]
y: [  x/1 ]

how do i get the value from y/1 ? I know this is perhpas very newbe 
but once every year I always run into this and can figure it out...

reduce y/1 gives me x/1 but I want 2.. Im missing somekind of  'eval 
y/1 ...
Henrik
20-Nov-2006
[6282]
do y/1
[unknown: 10]
20-Nov-2006
[6283]
no that gives me also x/1
Henrik
20-Nov-2006
[6284]
it works fine here?
[unknown: 10]
20-Nov-2006
[6285x3]
not here..
>> x: [ 1 2 3 ]
== [1 2 3]
>> y: [ x/1 ]
== [x/1]
>> do y/1
== x/1
>> x: [ 1 2 3 ]
== [1 2 3]
>> y: [ x/1 ]
== [x/1]
>> do y/1
== x/1
odd ...
Henrik
20-Nov-2006
[6288x2]
>> x: [2 4 6]
== [2 4 6]
>> y: [ x/1 ]
== [x/1]
>> y/1
== x/1
>> do y/1
== 2
try a fresh console, I've done it successfully on mac with view 1.3.2 
and winXP with view 2.7.0
[unknown: 10]
20-Nov-2006
[6290]
your kidding me... Could that be a problem ?
Henrik
20-Nov-2006
[6291]
well, if some variable has been changed.
Gabriele
20-Nov-2006
[6292]
do on paths was added in 1.3.1 or something i think.
Henrik
20-Nov-2006
[6293]
hmm... it could be that it evaluates as a path
[unknown: 10]
20-Nov-2006
[6294]
mmm nope no effect ->
>> x: [ 2 4 6 ]
== [2 4 6]
>> y: [ x/1 ]
== [x/1]
>> y/1
== x/1
>> do y/1
== x/1
>>
Henrik
20-Nov-2006
[6295]
rebolinth, system/version ?
[unknown: 10]
20-Nov-2006
[6296]
REBOL/Core 2.5.6.4.2
Gabriele
20-Nov-2006
[6297x2]
use 2.6 :)
otherwise you need to  do y   or  do reduce [y/1]
[unknown: 10]
20-Nov-2006
[6299x2]
Mmmmmmmm all that brain cracking the whole day .... in 2.6 its working...
Thanks...I finaly can finish my Brain-Game ;-)
Graham
21-Nov-2006
[6301x3]
Anyone built an xml to rebol object utility?
I'm talking about well formed xml, no attributes involved.
No matter, xml-to-object works fine.
Ladislav
21-Nov-2006
[6304]
Please do not run this in REBOL console. Instead I want you to tell 
me what you expect as a result:

unset 'a a/x: (a: 1x2 3)
Gabriele
21-Nov-2006
[6305]
i'd expect an error.
Henrik
21-Nov-2006
[6306x2]
I would probably expect 'a/x to be 3
depends if it checks whether the path exists or not before the () 
part is evaluated
Ladislav
21-Nov-2006
[6308x2]
...and what you expect in case:

a: 1x2 a/x: (a: [x 4] 3)
or:

    a: 1x2 a/x: (unset 'a 3)
Henrik
21-Nov-2006
[6310x2]
a = [x 3]
I'd expect path error.
Ladislav
21-Nov-2006
[6312]
generally spoken, the "post-check" checking after the () part is 
evaluated looks safer (IMO)
Gabriele
21-Nov-2006
[6313]
so, interpreter should evaluate the argument first, then the set-path?
Ladislav
21-Nov-2006
[6314]
if implemented the other way around, it is unsafe (IMO again)
Gabriele
21-Nov-2006
[6315x5]
but:
>> f: func [/x] [print "huh"]
>> f/x
huh
>> f/x:
huh
so... what happens with a/x: (a: func ...) ?
it would be evaluated out of order.
(if a was already func that is)
Ladislav
21-Nov-2006
[6320x2]
My proposal is, that

f: func [/x] [print "huh"]
f/x: 1

should be an error (cannot use set-path on a function)
OTOH,

    f: func [/x] [print "huh"]
    f/x: (f: 1x2 3)

should behave differently
Gabriele
21-Nov-2006
[6322]
it's mainly a matter of wheter it is more natural for the set-path 
to be evaluated first or last.
Ladislav
21-Nov-2006
[6323x3]
the trouble is, that only the second variant may be safe (IMO)
, because the first variant relies on information, that may be "invalid"
I will put these to RAMBO, do you agree?
Henrik
21-Nov-2006
[6326]
I agree
Ladislav
21-Nov-2006
[6327x2]
well, there is a possibility to use the strategy to "partially evaluate" 
the set-path before evaluating the argument, but then e.g.

a: 1x2 a/x: (a: 3x4 5)

should yield a == 5x2 and

a: 1x2 a/x: (a: [x 4] 3) should yield a == [x 4]
hmm, the last example is strange, actually, I guess, that the only 
reasonable variants for a: 1x2 (a: [x 4] 3) are a == 3x2 or a == 
[x 3]
Anton
21-Nov-2006
[6329]
I think I don't like the "partial evaluation".