[REBOL] Re: Problem? load %script.r - howto retrieve all!!??
From: joel:neely:fedex at: 18-Mar-2002 6:01
Hi, Norman,
This isn't exactly an answer to the question as you posed it,
but here's something I do that helps deal with the situation.
Rather than having a REBOL file (*.r) contain a collection of
various parts, I prefer to
1) make sure that a single source file contains components
of a single specific concept, and
2) wrap the entire collection in an object.
I used to create source files that read like this:
REBOL [
...
]
foo: make object! [
...
]
with only a single object per source file. If the object
contained a method that was intended for stand-alone use,
that method was usually named RUN , so that I could type
at the console something like
generate-html/run %filename
If I wanted to be able to use the function from the command
line, I'd simply follow the object definition with an
evaluation of the RUN method with appropriate arguments.
The above strategy would help avoid clobbering globally-
defined words (or words defined in another source file)
and would allow the listing of the object just loaded to
see all its content.
More recently, I've started defining "bare objects" without
assigning a name in the file, such as
REBOL [
...
]
make object! [
...
]
This way I can say
glorp: load %sourcfilename.r
either at the command prompt or within another source file,
and control the scope of the loaded object more precisely.
However, the other benefits above still apply.
HTH!
-jn-
[Robolinth--nodep--dds--nl] wrote:
> Hello All,
>
> I hope a Rebol guru inhere can answer me the folloing question.
> As from the beginning im always using the Rebol/Core console to
> program in, testing etc, and afterwards Im putting it into an editor.
>
> Well as the rebol/core console does not support something like
> line-numbers its impossible to save a file created inside the console,
> or im doing somthing realy wrong...(this is not my question ;-)
>
> Anyway the problem is the following:>
>
> When loading or reading a file I would like to know ALL
> the functions, blocks, etc..that where actived while loading the
> file. There is no such command like "source loaded-script"
> (Im now always using [ loaded: read %example.r ]) but thats a too
> workaround..
>
> I always have to look inside the script to know what is loaded
> befor I can even know what im loading or activating with a read.
>
> I never know what functions are activated at that time, perhpas they
> even overwrite my current ones? (okay a protect could work here)..
>
> Does anyone know what im talking about here?? ..I hope so.. :-)
>
> Thanks in advance,
>
> (R)egards,
> Norman.
>
> -- dinner/conversation: "How do you eat your Rebol in the morning?"
> --
> To unsubscribe from this list, please send an email to
> [rebol-request--rebol--com] with "unsubscribe" in the
> subject, without the quotes.
--
; Joel Neely [joel--neely--fedex--com] 901-263-4460 38017/HKA/9677
REBOL [] do [ do func [s] [ foreach [a b] s [prin b] ] sort/skip
do function [s] [t] [ t: "" foreach [a b] s [repend t [b a]] t ] {
| e s m!zauafBpcvekexEohthjJakwLrngohOqrlryRnsctdtiub} 2 ]