develooper Front page | perl.perl5.porters | Postings from July 2011

Re: Why views are useful, and why their syntax doesn't matter much

Thread Previous | Thread Next
From:
Reverend Chip
Date:
July 10, 2011 19:01
Subject:
Re: Why views are useful, and why their syntax doesn't matter much
Message ID:
4E1A5979.6030405@gmail.com
On 7/10/2011 5:15 PM, Father Chrysostomos wrote:
> If you make them read-only it defeats the purpose of having an alias.

Um.  I think you're assuming a conclusion there, specifically, that you
know the only purposes an alias can have.  Obviously I have a purpose in
mind that read-only-ness does not defeat.

> If you want something more efficient than copying, we have copy-on-write for strings. Can we make perl use that more often?

I don't know how much COW is used now, or how it works.  COW might offer
a bigger speedup than views, depending.  Research required.

>  And isn’t copying an RV or a number just as fast as making a view?

Yes for RVs and non-stringified integers, pretty close for the other
numbers.

> I can’t speak for Perl 6, but making something read-only in Perl 5 just feels un-Perl-5-ish.

Perl 5 has to evolve, and Perl 5 has always had some read-only things. 
Or are you suggesting that   ${\3.14159}   should be mutable?  :)


PS: With views being available it's not like all parameters would be
readonly in practice; that would just be one of the options, hopefully
the default one.


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