good work, Cyrus, I really like import/export.
On Wed, 2006-06-14 at 09:28 -0700, Aaron Stone wrote:
Meat: has there been discussion on the list about what happens if an
undefined variable is used? I think it would be good to fall back on any
such definitions.
[VARIABLES] says:
Unknown variables are replaced by the empty string.
it's not an error.
An included script could pull in more variables than were exported, and
simply find that some of them are not defined. For example, a :global
script might have some documented functionality like, "export ${this}
for some useful behavior, and ${that} for some other useful stuff." A
user might only set ${that}, but the script has imported both ${this}
and ${that}. I don't think it should cause an error.
I agree.
If an "import" command lists a variable that has not been exported
and set by any other script at that point during the SIEVE execution
process, then an error MUST occur.
I suggest that "and set" is removed. remember that changes made to the
imported variable will be visible in the parent. this is how values are
returned from "calling" sub-scripts, and it would be strange to require
the parent to set it prior to the call. this should probably made clear
in the draft.
another issue -- the examples say:
| require ["variables", "include"];
| export ${test}
further up it says the argument is a string list, so it would have to be
export "${test}";
I would prefer that the variable name was used unadorned, however, as I
would expect ${test} to be expanded to the value, no matter how
nonsensical that is... so:
export "test";
it should also be made clear that the strings in the list need to be
constant strings, ie. without ${variable} references.
--
Kjetil T.