On 4/20/04 10:42 AM, Dan Sugalski wrote: > At 9:50 AM -0400 4/20/04, John Siracusa wrote: >> On 4/19/04 7:16 PM, Larry Wall wrote: >>> Well, no, we're still stuck at run-time validation of that. In the case >>> of methods you can't really do anything else anyway, generally speaking. >> >> Why is that? > > Because at compile time all you have is a generic thing, a (possibly > indirectly accessed) method name, and a list of parameters. There's > no good way to tell which method will ultimately be called, and > validating against all declared methods of that name won't get you > anything useful there since the result's likely going to be pretty > contradictory.
Hm, so how would the "is required" trait that Damian posted work? Would it simply be shorthand for a run-time check that I don't have to write myself? I was under the impression that it would work the way I described earlier: sub foo(+$a is required, +$b is required) { ... } foo(); # compile-time error! foo(1, 2); # compile-time error! foo(a => 1, 2); # compile-time error! foo(a => 1); # compile-time error! foo(a => 5, b => 7); # ok foo(b => 1, a => 2); # ok It really is a shame about the inability to do it at compile-time with methods, but shorthand for a run-time check in that case would be welcome too :) -John