> If I said that, I was mistaken. It will always return false because
> the first return value from C<want> is an expectation count, so:

Ok, here's your email cut-and-pasted, because I can't find it in the
frikkin' archives and I think it's worth re-visiting:

Damian Conway wrote:
> 
>    > Nathan Wiger wrote:
>    >
>    > How about recursive calls to want(), similar to multiple $$$'s?
>    >
>    >    if (want(want(want))) eq 'HASH' )
> 
> No, that's heading in the wrong direction (both figuratively and literally :-)
> 
> C<want> with no arguments returns a list of valid contexts.
> C<want> with arguments expects a list of contexts and returns true if they're
> valid. So:
> 
>         want(want)
> 
> is always true (in fact that's a good conformance test for C<want>).


Personally, I think this makes an incredible amount of sense, even if
you were temporarily insane. The return arguments and function arguments
should be symmetrical:

    ($same, $order, $of, $args) = want($same, $order, $of, $args);


> There is *NO WAY* I'm proposing what amounts to:
> 
>         ($expectation_count, $main_context, @other_contexts) = want 'LIST';
>         ($main_context, $expectation_count, @other_contexts) = want;
> 
> That's just evil! ;-)

Me neither! :-) All I was saying is that you could drop any args that
are specified:

   ($context, $expectation, @etc) = want;
   ($expectation, @etc)           = want 'LIST';
   (@etc)                         = want 'LIST', 2;

Anyways, that part's just a suggestion, and I'm not particularly fond of
it either. 

I'm not going to harp on this anymore, but I do think that the first arg
returned should be the context, if for no other reason than this will be
used much more often that the expectation count, which is only useful in
a small subset of the contexts want() covers.

-Nate

Reply via email to