Thomas Sandlaß wrote:

Rod Adams wrote:

How am I supposed to define a signature that says "A scalar that refers to a hash or array element, but do not evaluate or autovivify the element"?


I'll make a guess: Ref of Int of Array.
This assumes Int has a polymorphic subtype that allows
pointing into arrays. But unfortunately you need two values
to describe the reference: the index and the array. So it should
be more like a pair: Ref of Pair[Int,Array].

my @array;
my Ref of Int of Array $iref = 17 of $array; # 17 => @array perhaps

$iref = "blahh";
say "@array[17]"; # prints blahh


Or are these two are now strictly methods without functional forms?


Sorry I don't know what you are asking for. What is then a method with
functional form? Do you mean that the entries in an array are off-limits
to the outside and can be accessed only by the subscripting methods?

What I'm asking is if we are going to continue allowing:

 delete %x<foo>;
 if exists %x<foo> { ... }

or make it where you instead have to say

%x.delete('foo');
if %x.exists('foo') { ... }


-- Rod Adams




Regards,




Reply via email to