Currently only splice() and .data[] = are a Series/DataFrame mutators
So to make these objects read only (ie a soft version of immutable) can be done this way:
add a new has Bool $!ro = True; attr
add a new override method rw { $!ro = False } (you can manually override ro behaviour twiw)
and a new reset method ro { $!ro = False }
and a new clone method clone { ... } with :rw adverb
error if splice() or data[]= operations are attempted if $!ro [ie. splice is forbidden]
check that dyadic operations now work like this c = a.concat(b); [ie. a,b immutable]
implement this by psuedo-code:
method concat( \b ) {
my c = a.clone( :rw );
c.concat(b); #the mutating concat we have now (which may contain mutating c.splice(b) operations)
c.ro;
c
}
Currently only splice() and .data[] = are a Series/DataFrame mutators So to make these objects read only (ie a soft version of immutable) can be done this way:
has Bool $!ro = True;
attrmethod rw { $!ro = False }
(you can manually override ro behaviour twiw)method ro { $!ro = False }
method clone { ... }
with :rw adverbc = a.concat(b);
[ie. a,b immutable]oh and check grep
there are some interesting comments here
maybe concat can just use concat eg..
method concat( @b ) { |self, |@b }
oh and prevent write access to .data (eg. wrapper)