From: Chip Salzenberg <[EMAIL PROTECTED]>
   Date: Mon, 6 Feb 2006 08:22:21 -0800

   On Mon, Feb 06, 2006 at 07:33:08AM -0800, jerry gay wrote:
   > since we already have (as will reminded me) syntax that can be used to
   > express this difference, and it's tested, i may as well mention it.
   > 
   >   () = foo(42)
   > 
   > works and is tested (the last two tests) in t/compilers/imcc/pcc.t.

   No, when error checking is enabled, that throws an exception when foo
   returns something.  (And if it doesn't, it should!)

So maybe that could mean "I want exactly zero values," whereas

        foo(42)

could mean "I want any number of values"?  That way, the compiler could
specify whether or not extra values were OK in any given case.

   So what is missing is the ability to allow additional values after
one or more expected values.  I can say "Take between zero and two
values" like this:

        ($P41 :optional, $I41 :opt_flag, $P40 :optional, $I40 :opt_flag)
                = $P85($P45, $P46)

But there is no way to specify that three or more args are OK, without
actually specifying an explicit :slurpy register that will consume time
and memory.  Maybe Parrot should support an ":ignore_extras" keyword in
the last position?  So that

        (:ignore_extras) = foo(42)

is equivalent to the version above without the "=".  (Which preserves
orthogonality for code generators; you can do it all with the
parenthesized list syntax.)

   And something equivalent ought to be done for parameters.  Allowing

        .param :ignore_extras

would be directly equivalent, but ugly.  How about one of

        .ignore_extras
        .ignore_extra_params

instead?

   I see the handwriting on the wall -- it says that someday soon,
Parrot will insist on strict arg/return checking all the time.  In order
to support Common Lisp correctly (and efficiently), I would like to be
able to shut this off for returns without having to add a useless
:slurpy register everywhere.  Doing so for parameters is less necessary,
but also useful.

                                        -- Bob Rogers
                                           http://rgrjr.dyndns.org/

Reply via email to