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

[REBOL] Re: [bug?] Problem with 'load

From: SunandaDH:aol at: 28-Nov-2003 4:07

Thanks Anton and Max Anton:
> In my tests it looks like the needs block isn't evaluated, > just examined.
We might be seeing different behaviour on different versions of REBOL -- I'm looking at Win and Unix. It looks to me like the header is *always* evaluated, including the needs check, despite the /all refinement. Try this ===save next lines as temp.r=== A preamble: there is text before header, containing "bad things More text before rebol [print "gets printed if this is taken as the header"] rebol this isn't a header despite starting with the magic word rebol [print "gets printed if header is evaluated" file: %fff needs: [1.2.1 view]] print "gets printed if script is executed" =====end of test script===== This is what I see:
>> load %temp.r ;; evaluates header; returns body >> load/all %temp.r ;; crashes because preamble is not valid REBOL
>> load/header %temp.r ;; evaluates header; returns header >> load/header/all %temp.r ;; evaluates header; returns header
What I want is a way to load the header of *any* REBOL script regardless of its needs setting. Any one any ideas? Max:
>is this dialect actualy usable as a function given a block?
Looks like you can do a lot with it. I guess part of the original idea is that a script can load another's header and thus learn a lot about it. You could use that to build some sort of documentation tool. Or if I wrote something that alters a script (like a pretty printer) I could use the header to give it directives: rebol [ prettyprint [maxwidth: 50 comments: 'keep blanklines: 'drop] ] Trouble is. my prettyprinter would seem to be only able to load scripts that run under the same version that it does....Annoying or what? Sunanda.