gorillascript
gorillascript copied to clipboard
Modularity and scoping of macros
- How are we supposed to reuse/distribute macro libraries? Would be REALLY great to load macros using the same rules as Node's
require. - Can I, say, write my own
classmacro to redefine the language for a single file? - Any reason why FunctionDeclaration is a built-in thingie rather than defined via
macro syntax?
I know I can just read the code at this point, but still, this needs to be in the docs so hopefully a ticket is useful.
- A file can
importanother file, which only allows importing of consts and macros. e.g.import 'shared.gs'. - Not currently, but you could define a macro called
myclasswith similar semantics. Currently macros are interpreted in-order, so having a macro that matches first will never carry through to one that redefines it. Perhaps I could reverse the order so that newest macros are used first. That would probably work best. - Ease at the time. It also contains a lot of conditional logic and such, and the
ifmacro uses a function (as a way to mitigate looping), so having to define what a function declaration is before definingifwould be complex given the amount of logic that takes place within a function declaration. Perhaps I'll look into it again, though.
With #128, You can now override macros, making your second point handled.
@ckknight Nice, thank you! Should I make separate issues for the remaining two items, and then close this issue? Or maybe only for the first one?
Just the first one, I'd say, as I don't plan on changing FunctionDeclaration to a non-builtin due to the complexity.