develooper Front page | perl.perl5.porters | Postings from March 2023

Re: Pre-RFC Deep constants

Thread Previous | Thread Next
From:
Paul "LeoNerd" Evans
Date:
March 9, 2023 19:50
Subject:
Re: Pre-RFC Deep constants
Message ID:
20230309194944.5a023b38@shy.leonerd.org.uk
One complication I can immediately see is that, I presume by "deep
constant" you would want this entire thing to be readonly:

  const $x = [ [ 1, 2, 3 ] ];

But what about references to *existing* variables that happen to be
found inside a data structure:

  my @nums = ( 1, 2, 3 );   # normal mutable array variable
  const $y = [ \@nums ];

How would perl tell the difference between the two?

-- 
Paul "LeoNerd" Evans

leonerd@leonerd.org.uk      |  https://metacpan.org/author/PEVANS
http://www.leonerd.org.uk/  |  https://www.tindie.com/stores/leonerd/

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About