John M. Dlugosz has asked for the wisdom of the Perl Monks concerning the following question:
I suppose that the compiler figures out the first two based on static analysis. But what about the third? If @s contains exactly one value, will $q wind up with an item or a reference to a list of one item?$x= @a[4]; @y= @a[4,5,6]; $q= @a[@s];
Normally the context (item, list, etc) is determined by context, hence its name. But is the type of expression instead driving what the subscripting operator does, in the manner of multimethod overloading?
—John
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: [Perl 6] single-value vs. array slices
by moritz (Cardinal) on Mar 31, 2008 at 16:03 UTC | |
by mr_mischief (Monsignor) on Mar 31, 2008 at 16:18 UTC | |
by John M. Dlugosz (Monsignor) on Mar 31, 2008 at 19:14 UTC | |
|
Re: [Perl 6] single-value vs. array slices
by Anonymous Monk on Mar 30, 2008 at 13:08 UTC | |
by John M. Dlugosz (Monsignor) on Mar 30, 2008 at 20:03 UTC | |
by Anonymous Monk on Mar 31, 2008 at 09:47 UTC | |
by John M. Dlugosz (Monsignor) on Mar 31, 2008 at 10:02 UTC |