petdance/scratch — Issue #118: no args checking for a sub without params
Author: petdance
Created: 2011-11-01 05:27:05+00:00
State: open
Labels: imcc, Pri-normal, rfc, Sev-medium

Originally reported in [http://rt.perl.org/rt3/Ticket/Display.html?id=39844 RT].

If no .params are given, no args checking is done on sub invocation. From the original:

{{{
On Sat Jul 15 23:29:10 2006, mdiep wrote:
> I expect this to die with a "too many args" error, but it doesn't --
> it prints "ok":
>
> .sub main :main
> test("foo", "bar")
> end
> .end
>
> .sub test
> print "ok\n"
> .return()
> .end
>
> --
> Matt Diephouse
>
}}}

2 sample patches to achieve this (both of which are declared to fail) are attached to the original ticket. Neither apply cleanly to trunk.

There is a question, however, as to whether or not the existing behavior is desirable - should we always check args? should we always check except for :main? (should we check for :main too and suggest that the programmer use .param args :slurpy to avoid any issues?)

There's a test already committed in t/op/calling.t