On 2011-08-18 16:06, Carl Mäsak wrote:
I was working on the Little Animal Farm game yesterday, and wanted to
make it totally safe against tampering from the outside. (See
<http://masak.org/carl/yapc-eu-2011-little-animal-farm/talk.pdf>.)
I ended up implementing a custom accessor method and a sub to
deep-clone hashes, just to make sure that data belonging to readonly
attributes doesn't get changed.
[...]
* Are we fine with references from readonly attributes leaking out of
the class? Should we be?
* What language components could be provided to put class implementors
on the right path so that their classes end up encapsulated by
default?
* Could someone restate this whole problem space in a way that doesn't
make my head hurt?
How about having scoped permission limits?
(such that a code block can be disallowed to change data)
--
Ruud