On Tue, Mar 11, 2003 at 05:35:34PM -0800, Dave Whipp wrote: : The effect of a macro is lexical; but "the name may be installed in : either a package or a lexical scope". If the name is installed in a : class, can it be invoked via a variable of that class? : : Example (SQL query integrated via macro): : : my Database $db = MySqlDatabase.connect(...); : $db.select * FROM Foo WHERE Foo.bar LIKE a%b; : : Could I implement this with the select function being a macro on the : Database base class: but invoked via the $db invocant? I am aware that : the macro would be a compile-time operation: but it could resolve into a : run-time mechanism that uses the invocant.
If you use a module or class that defines macros, you can import the syntax at that point as well as the name. Might take an explicit import of the particular name to accomplish that though. But basically, yes, you can do that. Macros would be pretty darn useless if you couldn't import them. Larry