On May 4, 2005, at 2:38 PM, Thomas Sandla▀ wrote:
Aaron Sherman wrote:If we agree that the first say should print 7, then we must conclude that either we've changed the value of undef to 7, or we've created a circular reference.
In my view of refs 7 is printed, indeed. But I've difficulty to understand
what you mean with "the value of undef". Undefinedness to me is the absence
In Perl (5 and 6) there is actually a value, 'undef'. That value can be stored in variables, just like any other value. There is no real fundamental difference between '7', 'foo', and 'undef'...they are all values (although each has a slightly different set of meaningful operations). As a community, we have decided that 'undef' means something like "I don't know what this value is" and the perl engine enforces that, but there is nothing implicit about undef that requires it to mean that.
I think we agree that references are a level of indirection. We also agree that variables are names that allow us to get at---and here I think our views diverge---a box, cell or container for values. So after resolving a name, we always have one level of indirection from the cell to the value. To me a referencial value is just such a thing without an entry in a namespace or symbol table.
Not quite. *values* never have entries in a namespace or symbol table...e.g., there is no symbol table that stores 1,2,3...100000000000000, etc. You don't say "$x + number::integer::7" in order to add 7 to $x. A reference is a value, just like an integer or a string. It does not have a symbol table entry. It is, instead, stored in a container. Containers that have names are called "variables", containers that do not have names are (surprisingly enough) "anonymous". So, in Perl 5, "$x = [ 1 ];" creates a reference (a value) to an anonymous array (a nameless container) containing the literal number 1 (a value) and stores it in $x (a named container).
So, if you want, you can say that $x is a single level of indirection to get to its value...but, in the example above, its value is [ 1 ], not 1. Therefore, you have another layer of indirection. The name doesn't tell you anything about how many layers of indirection you're going to get.
And yes, Juerd and I have fundamentally different opinions of what has got identity. To me only values can be identical. Cells are an implementation vehicle to handle values.
It depends on how you define "identity", I suppose.