Some :include {once} weirdness
Adriaan de Groot <adridg-FlD2LfDziEhmR6Xm/[email protected]>
| Newsgroups | gmane.comp.tools.aap.user |
|---|---|
| Message-ID | <[email protected]> |
:include {once} is really very strict. It applies the onceness even in scopes
where the included file has never been seen. For example:
==main.aap
:child a/main.aap
:child b/main.aap
==
==local.aap
:print Local uses $TOPDIR
ONCET=$TOPDIR
==
==a/main.aap, b/main.aap
:include {once} ../local.aap
:print Recipe uses $?ONCET
==
After a/main.aap has included local.aap, b/main.aap doesn't, because
a/main.aap already has. However, in the scope of b/main.aap, local.aap has
never been seen. So if I were to use local.aap for setting variables, in the
scope of b/main.aap those variables will be unset. In particular, ONCET is
unset in b/main.aap.
This makes {once} even less useful than it might be, since it makes it hard to
amalgamate recipes under a parent. I need to check which files are included
{once} from the child recipes, and include them in the parent as well, just
to be sure that the one child recipe's {once} doesn't interfere with the
others'.
I think adding a note to the documentation about {once} is in order - it makes
sense for files defining :routes but for precious little else.
--
pub 1024D/FEA2A3FE 2002-06-18 Adriaan de Groot <[email protected]>
Key fingerprint = 934E 31AA 80A7 723F 54F9 50ED 76AC EE01 FEA2 A3FE
-------------------------------------------------------
This SF.Net email sponsored by: Free pre-built ASP.NET sites including
Data Reports, E-commerce, Portals, and Forums are available now.
Download today and enter to win an XBOX or Visual Studio .NET.
http://aspnet.click-url.com/go/psa00100003ave/direct;at.aspnet_072303_01/01