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

[REBOL] include, require, yamm, ... Re:

From: brian:hawley:bigfoot at: 14-Aug-2000 15:50

Boleslav Brezovsky ([weirddream--volny--cz]) wrote:
>Zdravim, > >Maybe you need something like C/C++ 'include in REBOL. Maybe you've used >'include, 'yamm, 'require, 'evoke... But nothing is perfect. I think that >'require is most advanced example but it misses one VERY CRITICAL FEATURE - >paths to look in for script. So I've implemented it to 'require instead of >writing my own function. It is compatible with the old one except if you >'require script without path it looks for it in known paths. You can add to >them but you cannot save them - you have to edit the file manually. But I've >wrote it in one and half hour so you can call it QUICK-HACK. > >I hope you'll find some bugs otherwise I'm perfect and there's no room to >improve myself :-)
I'll take a look at it. Already I can tell it's not reentrant, and the paths don't preserve themselves when the script is done again like the script list does. Should be easy to fix... I designed the require function this way to be more bulletproof when run in a long-running, server environment. It may seem to be overkill for quick scripts, but even there the reentrancy is essential in a script dependencies manager. Would you prefer a single search path list, a default list with the option to specify more paths, the option for a replacement list, or specifying the list every time? I gave a lot of thought to the API since the function was written to be used by people who didn't know how to program well. Any subtleties in the style of intended usage should be reflected in the interface. Of course, require will need a rewrite when module support is added to REBOL. It would probably be made obsolete by a proper implementation of the Needs header option. The ongoing task... Brian Hawley