Re: Attributes and :include

Bram Moolenaar <[email protected]> Sat, 02 Oct 2004 21:04:55 +0200
Newsgroups gmane.comp.tools.aap.user
Message-ID <[email protected]>
Tim Hemel wrote:

> I am trying to debug an aap file and while doing that, I run into
> some strange behaviour, which is not the actual problem, but might
> be related.

[...]

> Items = a { myattr=done }
> 	b { myattr=notdone }
> 	c
> 
> :attr { all = mine } $Items

[...]

> Now, I comment out the :attr command in the parent file, and we get an
> unexpected result:
[...]
> Hey! where did all my attributes go?


When you assign a string to a variable that is all that happens.  Thus
$Items is the list of items with attributes as you specify, but it's not
stored anywhere else.

When you use ":attr" to add attributes to an item, the attributes need
to be stored somewhere.  $Items remains unchanged.  Therefore nodes are
created for all the items and the attributes stored with them.

When you leave out the ":attr" command the nodes are not created and
get_attr() doesn't find the items.

-- 
hundred-and-one symptoms of being an internet addict:
48. You get a tatoo that says "This body best viewed with Netscape 3.1 or
    higher."

 /// Bram Moolenaar -- [email protected] -- http://www.Moolenaar.net   \\\
///        Sponsor Vim, vote for features -- http://www.Vim.org/sponsor/ \\\
\\\              Project leader for A-A-P -- http://www.A-A-P.org        ///
 \\\  Buy at Amazon and help AIDS victims -- http://ICCF.nl/click1.html ///


-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl