On Sat, Mar 15, 2003 at 05:32:41PM -0800, mlazzaro wrote:
: So my reading is that it's not possible to specify 'required' named parameters,
: unless we're completely missing something. My first impulse is that it's not a
: big deal, because who's gonna do that? My second impulse is... well... if I
: were writing a big library with big, hairy methods, and wanted to *require* the
: use of names for all params because the signatures are just too baffling
: otherwise, I can sortof see wanting that... If, for example, you are a purist
: who believes _all_ sub parameters should be named, we might want Perl to
: nonjudgementally support that particular neurosis. Bleah, dunno.
Your reading is correct. It's possible to force the issue at run time, at least:
sub foo(+$req = die 'You must supply a "req =>" argument') {...}
or maybe
sub foo(+$req = MUST) {...}
where "MUST" could be something even more magical, possibly even
recognized by the compiler, just as $CALLER::_ could be. But I'm
not terribly interested in supporting that particular neurosis.
Larry