in reply to Calling splice() on Immutable Arrays

How does it matter for Readonly? You can't splice a Readonly array.
#!/usr/bin/perl use warnings; use strict; use feature qw{ say }; use Readonly; Readonly my @arr => qw( a b c ); say "@arr"; eval { $arr[1] = 'B' }; say "@arr"; eval { splice @arr, 1, 1, 'C' }; say "@arr"; __END__ Output: a b c a b c a b c
($q=q:Sq=~/;[c](.)(.)/;chr(-||-|5+lengthSq)`"S|oS2"`map{chr |+ord }map{substrSq`S_+|`|}3E|-|`7**2-3:)=~y+S|`+$1,++print+eval$q,q,a,

Replies are listed 'Best First'.
Re^2: Calling splice() on Immutable Arrays
by SankoR (Prior) on Jul 13, 2016 at 10:22 UTC
    Currently, unlike scalars, Readonly's arrays and hashes are still based on tie(). This splice conundrum is one of the last things keeping me from moving totally away from tie magic (which, besides speed, has its own problems some of which are sitting on RT) on modern perl. I'd hate to get rid of one set of issues only to introduce a totally new set.

    Edit: I'm the maintainer of Readonly, btw. And by 'modern' I mean v5.8.8 or higher.