Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search

[REBOL] Re: variable scopes and recursive func

From: mokkel::gmx::de at: 11-Apr-2005 1:03

Ok, last time - I hope. :-) If I'm right the reason why the error came up at the first empty directory and if there has been none, then only the first subtree is traversed, because of the recursive rebinding of the word 'aFile to the repeat block. While recursing down the first branch of the directory tree the block gets all the time bound to a new version of 'aFile. Upon returning back from the recursion the function one level up doesn't find any more the 'aFile from before the recursive call and thus the test doesn't work or even fails. Fails when 'aFile has been bound to no value in the recursion when the directory was empty or to the last value of the file in the deepest directory, which just gets added as often as during the walk up in the tree some files (no directories) are encountered, because always the second block of 'either gets executed. :-) Just a question to somebody who might know: One of the reasons why the binding mechanisms of Rebol are necessary is to make the keywordlessness possible, else something like 'repeat wouldn't be possible, right ??? But nevertheless I think these binding issues should be one of the first things to be explained to a newcomer. It is an important property of Rebol and should be treated like this. If there are chances to encounter these things in normal life they have to be explained appropriately already on the beginning and not on some articles (Ladislavs Bindology) or some sidenote in the documentation that a function changes it's body argument. Without deeper glue of Rebol it's hardly to get the reason and just simply using hints like using copy/deep on a block in some circumstances is hard to remember and hard to explain. Thus if Rebol is like this it should be put on the frontplate. ????!!!! Michael On Sun, 10 Apr 2005 23:43:04 +0300, Michael Berg <[mokkel--gmx--de]> wrote: