Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Constant CPAN distribution.

Report information
The Basics
Id: 74525
Status: resolved
Priority: 0/
Queue: Constant

People
Owner: Nobody in particular
Requestors: NEILB [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 1.21
Fixed in: (no value)



Subject: Make complex data structures immutable
If you use Const::Fast and define a constant as an arrayref or hashref, it will make the whole data structure immutable. I think it would be handy if the constant pragma did this. Then you could: use constant HASHREF => { a => 1, b => 2 }; and then do HASHREF->{a} and know that it's immutable. You can do the above now, but you can change the contents of the referenced hash.
Subject: Re: [rt.cpan.org #74525] Make complex data structures immutable
Date: Tue, 4 Sep 2012 15:13:12 +0200
To: bug-Constant [...] rt.cpan.org
From: Sébastien Aperghis-Tramoni <saper [...] cpan.org>
Hello, Neil Bowers wrote via RT: Show quoted text
> If you use Const::Fast and define a constant as an arrayref or hashref, it will make the whole > data structure immutable. > > I think it would be handy if the constant pragma did this. Then you could: > > use constant HASHREF => { a => 1, b => 2 }; > > and then do HASHREF->{a} and know that it's immutable. > > You can do the above now, but you can change the contents of the referenced hash.
Sorry, but because constant.pm really is a core module, its development happens on perl5-porters, so I suggest discussing this feature there, or opening a ticket on Perl RT with perlbug. -- Sébastien Aperghis-Tramoni Close the world, txEn eht nepO.