Re: dllobject/libobject

Bram Moolenaar <[email protected]>
Newsgroups gmane.comp.tools.aap.devel
Message-ID <[email protected]>
Adriaan de Groot wrote:

> On Wednesday 24 September 2003 22:53, Bram Moolenaar wrote:
> > 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.
> > 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.
> 
> What I've been using in my libtool module (as posted) is:
> 
> 	@dc = _no.get("DC")
> 	@if not dc:
> 		dc = $_recipe.DC
> 
> and then using $dc in the actual action. This makes overriding
> possible, and the DC setting itself local to the module.

This does exactly the same as "dc = $DC" after my change.  Thus it
appears to work as you expect.

> > 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:
> 
> Yes, that would be the most useful. I haven't figured out how to add a scope, 
> though .. I thought it would either be automatic or follow from a 
> create-topscope() call while initializing the recdicts in Scope.py, but I 
> never managed to get my scope "_module" to be recognized.
> 
> Bram, can you give a hint?

The module recipe already gets a scope.  Thus it's simply a matter of
adding the name in a table of scope names.  I'll look into this.

Suppose we import the "d" module, then using a variable name $d.DC
sounds logical, doesn't it?  Only problem is that using a variable "d"
won't work then, thus perhaps we should use a less obvious name.
#m_d.DC perhaps ("m_" for module).  Or use a more explicit name for the
module, such as "dlang".

-- 
How To Keep A Healthy Level Of Insanity:
5. Put decaf in the coffee maker for 3 weeks. Once everyone has gotten
   over their caffeine addictions, switch to expresso.

 /// 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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.