Re: initial stab at :import

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

> On Tuesday 16 September 2003 11:13, you wrote:
> > When an action is invoked the scopes are setup to search for variables
> > in:
> > - the local scope of the action build commands.
> > - the call stack, scopes from where the action was invoked (with :do or
> >
> > - the recipe where the action was defined (the module scope)
> > - the toplevel scope
> >
> > This is the same as what is used for actions defined by the user, except
> > that the tree of parent recipes is not searched.  The difference with
> 
> Part of the "problem" here is about "disappearing" scopes. Consider,
> for instance, a child recipe defining an action for filetype d, where
> the action uses a particular variable defined in that child recipe.
> After the child is done, its variables are too, but the action remains
> defined in the global scope. If the action is invoked later, it fails,
> because the variables it uses aren't defined anymore.

You must be misunderstanding something.  The scope of a child recipe is
not deleted.  The action defined in a child can still access variables
there.  Example:

	main.aap:
		:child test/try.aap
		all:
			:do tryit any

	test/try.aap:
		THEVAR = the value
		:action tryit default
			:print $_recipe.THEVAR

% aap
the value
%

I notice that using $THEVAR instead of $_recipe.THEVAR fails.  Is that
a bug?  No, the documentation mentions that _recipe needs to be used.
The explanation about which scopes are searched for the action commands
could be clearer...

-- 
The process for understanding customers primarily involves sitting around with
other marketing people and talking about what you would to if you were dumb
enough to be a customer.
				(Scott Adams - The Dilbert principle)

 /// 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.