On Tue, Jul 28, 2009 at 01:22:28PM -0700, Jon Lang wrote: : Larry Wall wrote: : > Moritz Lenz wrote: : > : Either it's parsed as '@a[0] = (W, W)' (list assignment), then @a should : > : get both elements, and so should @z. : > : > Not according to S03, at least by one reading. �...@a[0] as a scalar : > container only wants one item, so it only takes the first item off : > the list, and the list assignment produces a warning on the second : > because it's discarded. Since an assignment returns its left side, : > only one element is available to @z from @a[0]. : : So, do we still have p5's 'want_array' (or whatever it was called)? : That is, the predicate that tells the you whether the function is : being called in item or list context? I know that the generalized : 'want' function proved to be unworkable; but I'd expect p6 to at least : be able to do everything that p5 can do; and that includes functions : that are aware of whether they're being used as singular or plural.
Perl 6 is not about doing everything that Perl 5 can do. It's about breaking everything that needs breaking. This is one of those things. We *may* have something like want someday, but if so, it can only work by time travel (read: return a type profile with lazy values, and let the eventual binding of the type profile call back for the actual values). But I doubt will require such for 6.0.0 in any case. But Perl 6 is based on knowing the types to do MMD, and we have to know at least those types, even if we don't know the values. That makes it very difficult for a function that wants to return *different* types based on the eventual dispatch, since the eventual dispatch depends on those types in a circular sort of way. Sanity dictates that we make time flow forward rather than backward for most of what Perl 6 programmers will want to do most of the time. Larry