Patrick R. Michaud wrote:
An even cleaner shortcut might be to use ^...@foo instead of ^...@foo.elems:

    for ^...@foo -> $k { do_something($k, @foo[$k]) }

Somewhat clearer could be:

    for @foo.keys -> $k { do_something($k, @foo[$k]) }

And some may prefer:

    for @foo.kv -> $k, $v { do_something($k, $v) }

I think the anti-pattern of "0...@foo.elems" (or its incorrect
form "0...@foo.elems") should probably disappear in favor of
the above forms instead.

Even if there is no language change, at least it'd be good to ensure that "0...@foo.elems" doesn't appear in the documentation. Instead, whoever writes the docs should use @foo.keys and @foo.kv. Those are *very* clear, and they do the right thing.

Daniel.

Reply via email to