Am 09.09.2011 12:44, schrieb Carl Mäsak:
Non-rw attributes, non-rw parameters, and non-rw return values all
share the same mechanism. Fine. Makes sense.
[...]
Non-rw-ness in this case should be "all the way", not one level down.

(I hope I didn't change the meaning by stripping parts of your quote).

Woah there. Every routine that returns something mutable would have to indicate that in its signature, and there are a lot of routines that return mutable objects, or lists thereof (map, sort, grep, first, constructors of ref types, ...)

That would basically move Perl 6 to a level where you have to declare mutability in an almost Haskell-ish way.

I think we should consider the implications of immutability-all-the-way-down before we jump to any conclusions. In particular list cases where typical Perl 5 code fails when ported to Perl 6.

Basically any code that deals with file handles, database handles, statement handles etc. (all mutable objects) would need to take care while passing them around, because a single non-rw return would render them immutable, and thus useless.

I used to be in favor of the immutability approach, but the more I think about its effect on actual code I've written in the past, the more I get scared by the thought.

Cheers,
Moritz

Reply via email to