> I believe you'd have to create a class for such things, derived from Array:
> 
>       class AppOnlyArray is Array {
>               method STORE(int $index, $value) {
>                       fail "Can't modify existing element"
>                               if 0 <= $index < .length;
>                       .SUPER::STORE($index, $value);
>               }
>       }
> 
>       my @array is AppOnlyArray;

This seems wrong to me... simply because it's easier to do in C++ than
it is in Perl... which has never been the case.

    class Object;
    void add_stuff(list<const Object>&) {...}

(Disregarding the fact that list<Object> doesn't, in fact, convert to
that...)

I would imagine that you could just declare a sub as:

    sub add_stuff(@arr of Object is constant) {...}

Where the "is constant" presumably refers to the Object, not the
Array.  Or does that go like this:

    sub add_stuff(@arr of (Object is constant) {...}

Or does it go like something else?

Luke

Reply via email to