World: r3wp
[Core] Discuss core issues
older newer | first last |
Gabriele 20-Nov-2006 [6298] | 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". |
BrianH 21-Nov-2006 [6330] | I don't see the point to the partial evaluation either. A set-path will always evaluate its argument, so you don't need to preevaluate the set-path to determine whether the argument will be evaluated - it will. Just evaluate the argument ahead of time. If the set-path fails later, so be it. |
Ladislav 21-Nov-2006 [6331] | yes, that is my favourite variant too, unfortunately different than the one currently used |
Geomol 21-Nov-2006 [6332] | Ladislav, I would go for the fastest implementation. So double-check is out of the question. Then post-check must be the best and safest way (I guess!?). unset 'a a/x: (a: 1x2 3) should then make a holds 3x2. a: 1x2 a/x: (a: [x 4] 3) should make a be [x 3] a: 1x2 a/x: (unset 'a 3) should give an error. I think, this is correct. I'm not 100%. |
Gabriele 21-Nov-2006 [6333] | if you find it intuitive, then I'm for the change too. |
Cyphre 22-Nov-2006 [6334] | Geomol, this looks correct to me too. |
Geomol 22-Nov-2006 [6335] | This is a strange corner of REBOL. And one not often explored. A good developer would probably not do something like: unset 'a a/x: (a: 1x2 3) But we can't be sure. Maybe it's a really good trick sometimes to write something like that. In general it's good practise to only set internals of values, IF it's valid up front (, so I understand, that Gabriele would expect an error). But of course REBOL should be able to handle it, if someone wrote such tricky code. It shouldn't be undefined, what would happen. I feel, the post-check (that Ladislav is talking about) is the safest (and fastest) way to handle this, and then maybe in the documentation notice, that it's bad programming practise to do this. |
ICarii 22-Nov-2006 [6336x3] | is there any way to do 64bit integer operations with rebol without resorting to strings? something like 36969 * 1234567890 overflows rebol :( |
decimal unfortunately wont work without large slowdowns as I need to do AND/XOR/OR operations on the result | |
igonre my last post - i see Carl has already written about 64 bit in his blog.. Meh, guess ill have to use C# for the meantime :( | |
Ladislav 23-Nov-2006 [6339x3] | Geomol: I agree, but to have it complete, here is a more complicated expression: a: [1 2 3 4 5 6 7 8 9] i: 2 a/(i: i + 1): (i: i * 2 0) What should i and a look like? |
This leads us to the path evaluation too. What should be the result of: a: [1 2] a/(a: [3 4] 1) | |
Or to yet another crash: a: 1x2 a/(a: [3 4] 1) | |
Anton 23-Nov-2006 [6342] | Maybe the actual behaviour should be documented as undefined - ie. "don't go there". |
Ladislav 23-Nov-2006 [6343] | yes, that is a reasonable variant too |
Anton 23-Nov-2006 [6344] | Ladislav, your example: a: [1 2 3 4 5 6 7 8 9] i: 2 a/(i: i + 1): (i: i * 2 0) The actual behaviour seems good to me. That is, the first paren is evaluated, then the path is resolved, then the second paren. |
Ladislav 23-Nov-2006 [6345] | yes, looks OK |
Anton 23-Nov-2006 [6346] | Maybe this example a: [1 2] a/(a: [3 4] 1) is better as a: [1 2] a/(insert clear a [3 4] 1) |
Ladislav 23-Nov-2006 [6347] | how about this one? a: 1x2 a/(a: 3x4 1): (a: 5x6 7) |
older newer | first last |