Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Calling splice() on Immutable Arrays

by choroba (Cardinal)
on Jul 13, 2016 at 09:34 UTC ( [id://1167674]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1167674]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2024-04-19 22:42 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found