HaloO,

John M. Dlugosz wrote:
So a function can only supply values for one dimension?  Given
  @array[foo;bar]
each function is called in list context and returns a list for one of the 
dimensions.


 But what if you wanted a function to replace the literal subscript in:
  @array[1,2;1;3]
  @array[foo]  # what does foo return to be equiv to the first line?

sub foo { return (1,2;1;3) }

The thing the spec is unclear about is what "as part of a subscript"
means. In @array[foo] the sub should see the whole context, though.
I guess the parser is producing slice context at compile time because
it sees &postcircumfix:<[ ]>. The point is that in @array[foo;bar] it
is unclear how to split the dimensions of @array into contexts for
&foo and &bar if @array is more then two-dimensional. In the case of
@array.dim == 2 &foo and &bar are in list context anyway. Actually the
shape of @array is generally unknown until runtime.

Now my question: could slice context be a runtime feature that acts
before the dispatch to &postcircumfix:<[ ]> by retrieving the shape
of the @array and handing it over to &foo as context, capture the
shape of the slice returned and hand over the remaining shape as
context to &bar? Since relying on the order of &foo and &bar in the
source is bad, an even more elaborate scheme can be used that queries
&foo and &bar before the actual call which slots they intend to fill
in the pending slice operation.


Regards, TSa.
--

The Angel of Geometry and the Devil of Algebra fight for the soul
of any mathematical being.   -- Attributed to Hermann Weyl

Reply via email to