Dave Whipp wrote: > Does defining the invocant as "Num @self is constant" constrain the application > of the role to read-only uses of indices? I don't think you need "is constant". arguments are readonly by default, unless you give them the "is rw" trait. I guess that "is constant" means that you can specify the index only using a literal, not a variable, eg: @test[1]; # ok, 1 is a costant my $idx = 1; @test[$idx]; # nok, $idx is not a constant but I may be wrong. > Does the explicit indexing by an "int" typed value ensure that > it'll be non-recursive under MMD? you mean "Num" typed value? if so, I guess using an explicitly non-integer index would make it win under MMD. on the other hand, your method could even not be called at all with an integer index. > If I later decare a sub as > > sub foo ( @in does LinearInterpolation ) { ... } > > Would I be able to pass a normal (non-interpolating) array to this sub, > and then access it using non-integer indices (i.e. is the data in the > array independent of the interface through wich it is accessed). I don't think so. I'm afraid you have to do something like: sub foo (@in) { my @_in = @in; if(! @in.does(LinearInterpolation) ) { @_in does LinearInterpolation; } # go ahead using @_in ... } cheers, AldoThread Previous | Thread Next