The parse-time trick is helpful, but it's not perfect. I'm getting an error:
Generic word length does not define a method for the source-file class.
If you're familiar with Ruby's "require" or Python's "import", they look in
the user's current directory, i.e.
C:\CoolStuff\> python coolstuff.py
will have Python search in C:\CoolStuff\ for relevant modules.
I hope that your macro does this. I'm trying to import code from
scriptedmain.factor<https://github.com/mcandre/scriptedmain/blob/master/scriptedmain.factor>into
test.factor<https://github.com/mcandre/scriptedmain/blob/master/test.factor> in
such a way that no matter which directory those two files are in, as long as
they're in the same directory, factor test.factor would work.
If this is what the macro does, could Factor do this automatically? I think
USE and USING would have to be modified in order for that to work.
Cheers,
Andrew Pennebaker
www.yellosoft.us
On Fri, Aug 19, 2011 at 6:32 PM, Joe Groff <arc...@gmail.com> wrote:
> On Aug 19, 2011, at 2:57 PM, Andrew Pennebaker wrote:
>
> There must be a more dynamic way than configuring Factor for every piece of
> code I write. What if Factor interpreted "." as the directory from which
> Factor was called?
>
>
> If you're trying to load modules relative to a main script file, a bit of
> parse-time evaluation before the USING: line will do the trick:
>
> <<
> USING: io.pathnames namespaces source-files vocabs.loader ;
> ! add the script file's parent directory to the search path
> file get parent-directory add-vocab-root
> >>
>
> USING: something.relative.to.this.file ;
>
> Is that what you're going for?
>
> -Joe
>
>
> ------------------------------------------------------------------------------
> Get a FREE DOWNLOAD! and learn more about uberSVN rich system,
> user administration capabilities and model configuration. Take
> the hassle out of deploying and managing Subversion and the
> tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2
> _______________________________________________
> Factor-talk mailing list
> Factor-talk@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/factor-talk
>
>
------------------------------------------------------------------------------
Get a FREE DOWNLOAD! and learn more about uberSVN rich system,
user administration capabilities and model configuration. Take
the hassle out of deploying and managing Subversion and the
tools developers use with it. http://p.sf.net/sfu/wandisco-d2d-2
_______________________________________________
Factor-talk mailing list
Factor-talk@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/factor-talk