Re: RFC 110 (v3) counting matches

[email protected] (Tom Christiansen)
Newsgroups perl.perl6.language.regex
Message-ID <20816.967574194@chthon>
>And hashes are assembled just like lists anyways:

>   %hash = list get_key_vals;
>   %hash = (key, val, key2, val2);  # same thing

Eh?  List context is conferred by the % on the LHS.  You need
no redundant listification redundancy there.

>But no, I certainly wouldn't suggest going down the path of 1000
>explicit contexts. Bad. Implicit context good! But a "list" helper
>function like a "scalar" helper function would solve a lot of common
>problems.

No, a list helper function would *not* solve a lot of *common* problems:

    There's no C<list> function corresponding to C<scalar> since,
    in practice, one never needs to force evaluation in a list
    context.  That's because any operation that wants R<LIST> already
    provides a list context to its list arguments for free.

It's not a "common problem".

Now, you *can* force list context, but I (and Larry, one of whose
text I just quoted) don't see it as common, so it's not worth the
word.  But it's not impossible, either, as you can use either the
construct @{ [ ... ] } if you're in a string and trying to interpolate
some function call, or simply through ()=... otherwise.

Education is a wonderful thing.

--tom
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.