Re: dllobject/libobject
Bram Moolenaar <[email protected]>
| Newsgroups | gmane.comp.tools.aap.devel |
|---|---|
| Message-ID | <[email protected]> |
Lars Ivar Igesund wrote: > ----- Original Message ----- > From: "Adriaan de Groot" <adridg-FlD2LfDziEhmR6Xm/[email protected]> > > > It looks a heck of a lot like a module to me, already. I added > > mention of "the D module" to the documentation in yesterday's > > patches. There's a few things that might need to be checked, like > > using _recipe scope in actions. You could apply my module patch from > > yesterday, copy dmodule.aap into the executable dir (where system > > default.aap lives), and use > > > > :import dmodule > > > > in your recipes. > > Hmm, it seems like I have some scope problems. I did as you said above > and then called aap in my project dir. It started to complain that that > DC was an unknown variable, although it is defined at the top of the > module (at least in my version). Prepending it with _recipe or _no > didn't work. Other suggestions or is it a bug? In the currently released versions the commands of an action do not search for $DC in the scope of the recipe where the action is defined. Thus this doesn't work: DC = dcompiler :action compile object d :sys $DC $source -o $target You must use $_recipe.DC to access the variable, this should work: DC = dcompiler :action compile object d :sys $_recipe.DC $source -o $target But that means a user can't overrule the variable value, assuming he doesn't know what recipe the action is defined in. I have solved this problem yesterday, but the updated code hasn't been distributed yet. Will do that tomorrow. The result will be that $DC will first be searched for in the call stack, then the tree of recipes from where the action was invoked, and finally the recipe where the action was defined. I have wondered if the recipe where the action is defined should be searched before the tree of recipes. That might look more logical, but it's not backwards compatible. Opinions? An alternative (this was mentioned before) is to give the language module a named scope. That avoids name conflicts between different modules. Then it should work like this: DC = dcompiler :action compile object d :sys $m_d.DC $source -o $target And somewhere else: m_d.DC = gnudc -- Far back in the mists of ancient time, in the great and glorious days of the former Galactic Empire, life was wild, rich and largely tax free. Mighty starships plied their way between exotic suns, seeking adventure and reward among the furthest reaches of Galactic space. In those days, spirits were brave, the stakes were high, men were real men, women were real women and small furry creatures from Alpha Centauri were real small furry creatures from Alpha Centauri. And all dared to brave unknown terrors, to do mighty deeds, to boldly split infinitives that no man had split before -- and thus was the Empire forged. -- Douglas Adams, "The Hitchhiker's Guide to the Galaxy" /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net \\\ /// Creator of Vim - Vi IMproved -- http://www.Vim.org \\\ \\\ Project leader for A-A-P -- http://www.A-A-P.org /// \\\ Help AIDS victims, buy here: http://ICCF-Holland.org/click1.html /// ------------------------------------------------------- This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf