[Click] compound element keyword arguments
Eddie Kohler
kohler at CS.UCLA.EDU
Tue Mar 16 23:37:58 EST 2004
Hi all,
Click compound elements now support keyword arguments and "rest" arguments.
Examples:
elementclass Foo {
input -> Print -> output /* no arguments */
||
$a | input -> Print($a) -> output /* one positional argument */
||
COLOR $t | input -> Print($t) -> output /* a keyword argument */
||
$a, TS $c, __REST__ $rest | /* 1 positional, 1 keyword, 1 rest */
input -> Print($a, TIMESTAMP $c, $rest) -> output
}
Foo(); /* uses definition 1 */
Foo(what); /* uses 2 with $a == 'what' */
Foo(COLOR red); /* uses 3 with $t == 'red' */
Foo(money, whatever, TS true, OTHER foo)
/* uses 4 with $a == 'money', $c == 'true', and
$rest == 'whatever, OTHER foo' */
Compound elemnet keyword arguments are mandatory. So the following is an
error, because the MANDATORY keyword is missing:
{ MANDATORY $whatever | ... } ();
It turns out that __REST__ arguments work better if empty arguments are
ignored (I mentioned this in a previous email). So for now empty arguments
are ignored. Doug, how about 'perl -w' for the uninitialized-variable case
you were mentioning?
Eddie
More information about the click
mailing list