Closed Guevara-chan closed 5 years ago
Possibly. What specific functionality are you missing that import
can't do?
Import is for compiled binaries. And booi
is all about interpreting (look, Boo can be a script lang), so I want direct sourcecode importing.
Hmm...
That's tricky. The pipelined nature of the compiler means you can't do it as a macro, because all the parsing is finished well before macro expansion begins. (The compiler does have a sort of a way around this for internal macros, but it's weird and complicated and full of gotchas, so I'd prefer to avoid it.)
Boo.Lang.Useful.IO
does have a text preprocessor that could be run before the parser starts, that could be extended to recognize a require
statement and add a file to CompilerContext.Parameters.Input
, but it's not set up as a compiler step.
If you really wanted to, you could build this and submit a PR, though...
Yes, I want it. Whole presence of booi
was my reason to still cling with Boo with other options easiliy available. Yet, unfortunately, it's cannot my used for multifile projects easily.
All right. Well as I said, feel free to implement it and submit a PR. Have a look at BooTemplate for an example of inserting a preprocessing step before the parsing step.
Seriously ? I guess it's something in Boo.Lang.Interpreter
, like Eval(File(module).ReadAllText())
?
No, what you want to do is have require
add a new file to the list of compiler inputs, so it will be compiled together with the file you're currently compiling. (Make sure to have a loop in there to then preprocess that file, and a check that you don't pull in any file that's already part of the build, in case two files both require
the same third file.)
You want to put this in a compiler step, and insert it at the beginning of the pipeline, before Parsing
. BooTemplate does something similar, so I suggested it as an example.
compiling booi
Ahem... How about no ?
Booi is powered by the same compiler as booc. The only real difference is the last step; it executes the compiled code in-memory rather than saving it to disc.
Recently, while writing some service Boo scripts, I found myself missing good old
require
from Node.JS to better organize functionality and split some commonly used functions without compiling them.Is there any way to implement such functionality with macro and interpreter control interface ?