Re: References to hash elements?

[email protected] (Jeff Clites)
Newsgroups perl.perl6.internals,perl.ponie.dev
Message-ID <[email protected]>
On Jan 6, 2004, at 1:31 PM, Simon Cozens wrote:

> Jeff Clites:
>> But here what I'm copying is the _contents_ of the hash slot.
>
> True, but irrelevant. :)
>
>> And here I'm not making a copy, but also the thing I'm taking a
>> reference to is not the same thing I copied above. Here, it's a
>> reference to a hash slot.
>
> No, it isn't. It's a reference to a PMC. The fact that that PMC happens
> to be pointed to by a hash key is incidental. It's still just another 
> PMC.
> No special case at all.

Oh, I see what you are saying. I was misinterpreting what \$hash{bar} 
is supposed to do. (I was thinking there was supposed to be some new 
way to reference a hash slot, such that assigning to the reference [or 
dereferencing and assigning] would be equivalent to using $hash{bar} as 
an l-value.)

(But saying something is a PMC doesn't clarify anything--basically 
everything ends up being a PMC. PerlStrings are PMCs, hashes are PMCs; 
we have reference PMCs.... If we had a reference-to-a-hash-slot, that 
would be a PMC also probably. So your original post threw me off track 
when you referred to "a PMC rather than an immediate value".)

But I get it now--thanks!

JEff
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.