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

[REBOL]

From: anton:lexicon at: 21-May-2002 3:58

This is not important, I will just restart, but... In the middle of an extensive editing session just now, (using the new View beta,) I noticed this untamed behaviour:
>> split-path %index.r
== [%./index.r %index.r] ; what?
>> split-path %index
== [%./index.r %index] ; still crazy, let's investigate...
>> ?? split-path
split-path: func [ {Splits a file or URL path. Returns a block containing path and target.} target [file! url!] /local file path p][ p: %./index.r ;;; <------------- ((( notice this line... ))) path: parse/all target "/" if all [1 = length? path not empty? path/1] [ change path either any ["./" = path/1 "." = path/1 all [any ["../" path/1 ".." = path/1] p: %../]] [none] [to-file path/1] all [slash = last target path/1 append path/1 slash] return head insert path p] foreach item path [if item [append item slash]] if (last target) <> slash [remove back tail last path] file: last path remove back tail path file: to-file file if (length? path) = 0 [insert path slash file: none] path: rejoin path file all [any [file = %. file = %..] file: dirize file] either file? target [ reduce [to-file path file]] [ reduce [to-url join (copy/part target head target) path file] ] ] ; just check the global context...
>> p
** Script Error: p has no value ** Near: p Now, if you start a fresh rebol, you should see 'p initialised to %./ But it was changed somehow. How could any of my code modify the local 'p ? (I was doing a lot of stuff with index.r files, and I also patched path-thru slightly). How did the value of p get changed? How did the value escape from the local context of the function to be modified somewhere else? I cannot see a way, but perhaps some of you have ideas. Anton.