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

[REBOL] Re: Building scripts

From: brett:codeconscious at: 20-Jan-2002 12:34

> Becouse my scope is to realize as soon as possible the third of above > options, I had designed all my script to be easily included. After
> header are present command like: > > do %path/to/script01.r > do %path/to/script02.r > .... > do %path/to/script0n.r > > All included scripts are only declaration & definition of functions. > Functions will be used by code into the main script, which contain > specific functions and special function called as the script, which > embeddes all the main-code, and the last code line of the script launch > main-function with arguments if needed.
I have done something similar too. Though I use the word "use-script" instead of "do". This way I can redefine use-script according to the context the script is running in.
> Doing so it is easy to do cut'n'paste with a text-editor, but will be even > simple to make a script which collect all external script used by current > script and the make all substitution, using recursion it is possible > resolve deep inclution like script05.r includes script03., which > includes...
That's an interesting idea. I could already use "use-script" as my marker for script replacement. Another interesting idea is that in the same replacement fashion, use-script could create a function definition that makes a Rugby call. Romano had this idea: import librarydir db-select ; will do the file librarydir/dbms.r In this example import provides a naming service - it searches the library for the function. Plus it runs the file. I'm also unsure how the mooted rebol modules functionality will impact on this. So some interesting ideas: Where does your function definition live? [ in a block, in a script, in rugby ] How do you find it? [Using a naming service, a consistent directory structure, etc.] Brett.