World: r3wp
[Core] Discuss core issues
older newer | first last |
Henrik 30-Jan-2006 [3332] | anton, that's very interesting. a shame that I'm almost done now, still a few bugs left. :-) I solved the problem by going one step backwards. it happens to be that all objects are stored in a block so I can change it on the spot that way. the trick was to figure out how to move backwards and get the rules right. |
Anton 31-Jan-2006 [3333] | What does your system look like now ? |
Henrik 31-Jan-2006 [3334] | entangled in lots of debug code :-) |
Anton 31-Jan-2006 [3335] | I mean .. the essence of it .. :) |
Henrik 31-Jan-2006 [3336x2] | well, I use a structure like this: <word>: [ <id> make object! [ <word2>: [ <id2> make object! [ <word3>: [<id4> <id5>] ] <id3> make object! [ <word4>: [ <id6> make object! [ <word5>: [<id7>] ] ] ] <id4> make object! [ <word6>: [<id8> <id9>] ] ] ] ] |
a word relates to one or more values which relate to more words which can relate to more values | |
Anton 31-Jan-2006 [3338] | So it works ok ? |
Henrik 31-Jan-2006 [3339x2] | then I have a function that asks for a specific relation by diving down a path with a block like: [customers 1234 invoices 45 articles 15] to find customer 1234 who has invoice 45 which holds article 15 then there is a function to add and remove relations |
there are a few bugs left, but they are easy to fix | |
Anton 31-Jan-2006 [3341x2] | That's good. So you managed to stick with objects somehow, anyway. |
Oh I see of course. | |
Henrik 3-Feb-2006 [3343] | most bugs seem to be fixed now. I made a little release on http://www.hmkdesign.dk/rebol/ the question is whether this is useful to anyone :-) |
Anton 3-Feb-2006 [3344] | See how it performs for a little while, first... :-) |
MichaelB 3-Feb-2006 [3345x2] | this might be something dangerous: write %test.r "hello" path: what-dir remove back tail path write %test.r "hello" ; this fails problem is: what-dir returns directly system/script/path what seams to be used in order to resolve relative file values I just recognized it using the request-dir from didec which was in the rebgui distro -038 (he's doing this in the request-dir function in the line with if all [not empty? path slash = last path][remove back tail path] so question is whether this is a bug and belongs to rambo, is ok (I don't think so) or what else ? might also be that didec changed this in a later version (script was dated 2003 and maybe at this time 'what-dir had a different behavior), but this doesn't matter regarding what 'what-dir returns |
dangerous in the sense hard to get why suddenly some 'write doesn't work anymore | |
Volker 3-Feb-2006 [3347x2] | its another form of change-dir IMHO |
So there is no problem. except of the usual "easy to forget copy" in Dides case. Hmm, maybe this effect is really hidden, with what-dir beeing a function. Easy to expect it copies. | |
MichaelB 3-Feb-2006 [3349] | yes that's what I mean, nothing wrong with rebol, but who guesses that this returns a really vulnerable path |
Volker 3-Feb-2006 [3350] | Everyone who knows Carls ways of ssaving space. Although, i agree :) |
MichaelB 3-Feb-2006 [3351x2] | :-) |
but then Carl should write something about stylerules to add to every function documentation which states whether it's copying things or not - sometimes it's mentioned but like in 'what-dir 's case not - so either better styleguide or these things should be implemented the safe way | |
Volker 3-Feb-2006 [3353] | its easier to write when its copied.. |
MichaelB 3-Feb-2006 [3354] | what do you mean ? (you don't need to copy yourself - thus saving a word?) |
Volker 3-Feb-2006 [3355x2] | No, if there isnt mentioned "it returns a copy" better expect it does not.. |
WHich is rarely, so it is easier to add the few "it copies" then the lot "it does not" | |
MichaelB 3-Feb-2006 [3357x2] | ok, only problem I have is that in real world situations one can't think about everything and starting to copy everything everywhere just to be safe is no solution |
I'm thinking more in terms of some normal person (if there is something like that) and to me it seams quite a burden to think even about such tiny details | |
Volker 3-Feb-2006 [3359] | Dont take me serious, i am sarcastic! Although i don't know a good general solution for this copy-thing. |
MichaelB 3-Feb-2006 [3360x2] | and in my case it was even worse as I didn't know what happend until I stared to examine a outside script pretty closely and step by step following what it does |
yes I understand - I just don't know a good solution either | |
Volker 3-Feb-2006 [3362x2] | maybe it should really be a docu-rule. Forth has some flag-letters, like M: multitasking-impact etc. We could have C: copies/not, calls wait, what else? |
( i am away, cu) | |
MichaelB 3-Feb-2006 [3364] | bye |
JaimeVargas 3-Feb-2006 [3365] | This is what I called gotchas. |
Henrik 5-Feb-2006 [3366] | how do you test for a function that returns nothing? I want to DO a script, and check if there was an error, but the script might sometimes not return anything |
Volker 5-Feb-2006 [3367x3] | !>>error? [()] == false |
!>>unset? () == true | |
!>>attempt[() true] == true !>>attempt[1 / 0 true] == none | |
Anton 6-Feb-2006 [3370] | if error? set/any 'err try [do %script.r][print mold disarm err] |
DideC 6-Feb-2006 [3371x3] | MichaelB: about the path problem in request-dir, it's a bug in the code. The simple solution is to patch this line (in request-dir func at the end of the script : if not all [keep path] [path: any [where what-dir]] like this : if not all [keep path] [path: copy any [where what-dir]] |
the 'path word is local to ctx-req-dir context and the Rebol path must not be changed by it. It's up to the "user code" to change it if he wants to. | |
But I agree that Rebol should check if path is "complete" (trailing "/") before using it in read/save/load/... functions | |
Pekr 9-Feb-2006 [3374x4] | I have got question from Bobik, to which I don't know answer ... I tracked the problem, but dunno why it is as it is :-) |
blk: [1 false] if blk/2 [print 123] | |
he was wondering, why it is true .... I found out after checking the type? blk/2, which is - word! .... my question is why it is word! and not logic! ? | |
blk/1 is integer!, why false here is not logic! ? anyone? thanks :-) | |
Sunanda 9-Feb-2006 [3378x2] | blk: reduce [1 false] ;; to correctly evaluate the block contents |
I guess it's analogous to: blk: [1 make object! [a: 1]] print blk/2 make | |
Ashley 9-Feb-2006 [3380] | blk: [1 #[false]] |
Pekr 9-Feb-2006 [3381] | ok, thanks ... I think now I understand ... yesterday I read about Haskell and functional languages ... |
older newer | first last |