On 23 May 2001, Randal L. Schwartz wrote:

> >>>>> "Stas" == Stas Bekman <[EMAIL PROTECTED]> writes:
>
> Stas> I don't think that poping the first list's element for list.scalar is the
> Stas> intuitive thing to do. 'scalar @list' (== list.scalar) should be the same
> Stas> as list.size
>
> No, there's at least half a dozen different relationships between what
> a function does in a list context and what it does in a scalar
> context.  "size", "first element", "last element", "third element" (getpwnam),
> "string-representation" (localtime/gmtime), "one of many, leaving rest"
> (each, readline, readdir), "joined value" (``), and so on.

that's true. As long as you provide the context indentical to the one you
get in Perl itself, the right thing will happen. wantarray() was just an
example of course.

> I think "first element" actually makes sense here, since it applies
> equally well to both a one-element array and a scalar, which is what
> we're trying to unify.

OK, that's cool then. and for 'scalar @list' we have list.size anyway... I
just wasn't sure whether it won't introduce confusion for those who think
Perl, even when it's not exactly perl :)

Thanks Randal!

_____________________________________________________________________
Stas Bekman              JAm_pH     --   Just Another mod_perl Hacker
http://stason.org/       mod_perl Guide  http://perl.apache.org/guide
mailto:[EMAIL PROTECTED]   http://apachetoday.com http://eXtropia.com/
http://singlesheaven.com http://perl.apache.org http://perlmonth.com/




Reply via email to