World: r3wp
[Core] Discuss core issues
older newer | first last |
Steeve 26-Dec-2008 [11891] | ...somewhere |
[unknown: 5] 26-Dec-2008 [11892x3] | I copied it to death until I figured out it was in loop. |
Maybe not a bug just a need to use copy/deep in loop. | |
Steeve, I see what you were saying. I went ahead and fixed that by changing a piece of code so that the d block wasn't modified also. | |
BrianH 26-Dec-2008 [11895x2] | It's not a bg in loop, you are reusing the inner block [fname] where you shouldn't. |
>> d: [] == [] >> loop 2 [append d [1 [fname]]] == [1 [fname] 1 [fname]] >> same? second d fourth d == true | |
[unknown: 5] 26-Dec-2008 [11897] | Yeah we already determined that. Thanks Brian. |
BrianH 26-Dec-2008 [11898] | Cool :) I couldn't tell based on the messages above. |
[unknown: 5] 26-Dec-2008 [11899] | Yeah Steeve keyed in on the problem. |
Davide 29-Dec-2008 [11900] | Is there a way to modify an object (adding and removing components) at runtime without rebuild it from scratch ? I remember an old thread in the mailing list abut this argument, but I cannot find it.. |
Steeve 29-Dec-2008 [11901x3] | not it's impossible in R2 but doable in R3 |
in R3 do: append my-object new-var | |
wrong, in R3: append my-object [new-var: none] | |
Davide 29-Dec-2008 [11904] | R3 is going to be my nightmare :-) |
Steeve 29-Dec-2008 [11905] | when i need to simulate extendable objects in R2, i use blocks in replacement. |
Davide 29-Dec-2008 [11906] | I'm trying to find a workaroud using first object , second object ... but it doesn't seems to work |
Steeve 29-Dec-2008 [11907] | it can't |
Davide 29-Dec-2008 [11908x2] | I'm writing a function that replace every set-word in a block of code with a compoment of an object, so I have to build the object in one single pass |
(so every words become local for default) | |
Steeve 29-Dec-2008 [11910] | are there inner blocks which contain set-words too or not ? |
Davide 29-Dec-2008 [11911] | yes there are |
Steeve 29-Dec-2008 [11912x2] | so you can't use the construct function on the primary bock... |
except if the local vars are all set in the primary one too | |
Davide 29-Dec-2008 [11914] | the code is an handler so it could be everything |
Steeve 29-Dec-2008 [11915] | y |
Davide 29-Dec-2008 [11916x2] | I'm looking in lfulc code by ladislav, the parse rule to catch the set-words is quite simple |
lfunc | |
Steeve 29-Dec-2008 [11918] | you could write your handler in a context directly, it's the most simple thing to do |
Davide 29-Dec-2008 [11919x2] | it's in a context |
but the words used are still global, no ? | |
Steeve 29-Dec-2008 [11921x2] | not those which are scoped directly by the context |
ctx: context [ a: 1 block-code: [a: a + 1] ] a is defined local to the context ctx | |
Davide 29-Dec-2008 [11923x2] | I'm not sure if this can apply to my app. It's a web server so I have to mantain client values between session |
the context is unset after single request | |
Steeve 29-Dec-2008 [11925] | and ??? it's not related with your previous request |
Davide 29-Dec-2008 [11926] | If I change the code as: ctx: context [ saveobj/a: 1 block-code: [saveobj/a: saveobj/a + 1] ] I can retain the counter between web session |
Steeve 29-Dec-2008 [11927x3] | you lost your context, because you don't keep him in memory (i don't know how to answer to this problem) |
saveobj is not in your context | |
ctx: context [ localobj: saveobj localobj/a: 1 block-code: [localobj/a: localobj/a + 1] ] this should work... | |
Davide 29-Dec-2008 [11930] | yes ! saveobj is global, so I can use it for saving values that are in my context . In my context values will be lost. I'm writing a function to change every var in my handler like "var" to "saveobj/var" |
Steeve 29-Dec-2008 [11931x2] | i don't see y |
i don't see your point... ctx is global too... you shoul'd not lose it | |
Davide 29-Dec-2008 [11933x2] | Yes, I'm not too clear .... I unset the handler block every request I get |
so If I need to keep the values of the hadler I need to store them in a global ojb | |
Steeve 29-Dec-2008 [11935x2] | i think you have several problems not not necessarily linked, you should have a look on rebol.org, there are many web servers examples |
sorry... | |
[unknown: 5] 29-Dec-2008 [11937] | Wow another webserver. Does REBOL have the record in webservers? |
Davide 29-Dec-2008 [11938] | thanks ! only talking about this cleared my mind, I'm thinking about keeping the handler in memory |
[unknown: 5] 29-Dec-2008 [11939] | That is really cool Davide. |
Steeve 29-Dec-2008 [11940] | surely ;-) |
older newer | first last |