At 1:32 PM -0800 1/6/04, Jeff Clites wrote:
On Jan 6, 2004, at 9:25 AM, Leopold Toetsch wrote:

Arthur Bergman <[EMAIL PROTECTED]> wrote:
Hi,

I am wondering how the references to hash elements are planned to be
done? The call to set_ must somehow be delayed until the time is right.

$foo = \$hash{key};

$$foo = "bar";

$has{key} is now "bar"

There was some discussion WRT that issue months ago. Currently the implementation is wrong IMHO. When $hash{key} doesn't exist a new PerlUndef is returned (which is fine) but it should be stored in the hash too, so that assigning to $foo does The Rigth Thing. (Parrot aggregates have reference semantics, so ...)

This may have been discussed previously, but I would think that reading a hash should never auto-vivify elements.

This is entirely a matter of opinion and data design -- both options are reasonable, and would depend entirely on the definitions imposed by the language (if they're core data elements) or the class author (if they're not).
--
Dan


--------------------------------------"it's like this"-------------------
Dan Sugalski                          even samurai
[EMAIL PROTECTED]                         have teddy bears and even
                                      teddy bears get drunk

Reply via email to