Larry Wall larry-at-wall.org |Perl 6| wrote:
Alternately, we leave @@ (or @%) meaning ยข and instead let some
other syntax take over the "pay attention to the capture's structure"
semantics from @@.  Maybe it's another use for the zen slice:



"pay attention to the capture's structure" is a can of worms. As things stand now in the Synopses, you get a lot of empty extra wrappers around things. You don't want to keep that exact! When you are not doing full-blown flattening, which levels in the morphology are "extra" due to passing though functions or grouping parens, and which are intended to be part of the final structure? Since the crazy stuff inside the capture is usually invisible, people will have a hard time using that correctly.

(A literal reading of the synopses now gives us the morphology illustrated at <http://www.dlugosz.com/Perl6/web/med-loop.html>, and I hope to remove _some_ of those extra wrappings through refinement of the rules when I get around to studying that in detail.)

My thoughts at this point is that "slice context" needs to *know* it is being rolled up into a final result that is a 2-dim array. The rules for that will strip out extra wrappers except where it really is significant, designed through use cases of seeing what common constructs actually produce.

A shaped array knows what needs to be poured into it, so the RHS can be flattened. The single-dim array is just a special case of that; it generalizes to higher dimensions just fine, as seen in languages like APL.

A smart shaped assignment, to handle containers with * in other than the highest position, can be supplied as part of a multi-dim array Module, designed separately along with a coherent set of features such as general vector-driven transposes etc.

--John

Reply via email to