[Click] compound element keyword arguments
Douglas S. J. De Couto
decouto at csail.mit.edu
Wed Mar 17 11:48:06 EST 2004
re: perl -w
i don't really care, but as far as i can tell the only reason you would
ever give click empty arguments in an argument list is that you made a
mistake somewhere.
therefore, click should tell you there was a mistake.
(tounge in cheek, but only partly) : maybe there should be a click
pre-processor?
On 17 Mar 2004, at 02:37, Eddie Kohler wrote:
> 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
> _______________________________________________
> click mailing list
> click at amsterdam.lcs.mit.edu
> https://amsterdam.lcs.mit.edu/mailman/listinfo/click
>
--
Douglas S. J. De Couto <decouto at csail.mit.edu>
More information about the click
mailing list