Austin Hastings asked:

How do I specify an array which may be appended/pushed, but whose
values cannot change?

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;


How do I specify a hash whose current keys/values are fixed, but which
can accept new keys/values?

Same story.



Damian




Reply via email to