in reply to What's Really in a Reference?

Even though it is slightly sloppy usage, I tend to use "points to" as equivalent to "is a reference to". Generally speaking, if you think of a reference as an arrow drawn on a diagram, a variable which holds a reference to another is at the tail and is called a reference to (or a pointer to), and the item that the reference "points at" is at the head and is called the referent. On occasion you'll hear a referent called a "target", but this is less common, and I haven't used that in my point-by-point response.

  1. $pest has the value 'flea'.
    1. alternatively contains, has, or even is - is is very sloppy semantics, but common when dealing with direct values
  2. $dog points to $pest, which points to 'flea'
    1. alternate: points to a reference to 'flea', or (more precisely) is a reference to a reference to 'flea', if we don't know or care about the name of the intermediate variable
  3. $bob is a reference to a reference to $pest.
    1. a pointer to a reference
    2. a pointer to a pointer
  4. $bob points to a reference to a reference to 'flea'
    1. or is a reference to a reference to a reference to'flea' (more strictly correct)
    2. refers to a reference to
  5. $pest is the referent of $dog
  6. 'flea' is the referent of the referent of $dog
  7. $dog is the referent of $bob
  8. $pest is the referent of the referent of $bob
  9. 'flea' is the value of the referent of $dog
  10. 'flea' is the value of the referent of the referent of $bob
  11. $dog and $cat are both references to $pest
    1. or "both point to $pest", with "both" implying identity of the two reference values
  12. $bob and $sue are both references to references to $pest
    1. or "indirect references to $pest".
    2. If they both pointed to the same reference to pest, I'd say either
      1. the phrase I just used in 12.1 - though that does not communicate that their referent is the same reference, and it implies "one or more" intervening references, not "only one"
      2. say they are references to a reference to $pest.
        1. Note the use of "a reference" to indicate that the referent is the same for both variables; implication is that the reference to $pest may or may not be exactly the same one, only that both of the references pointed to are references to $pest.
        2. Alternative they are "both pointers to the same reference to" $pest, making the fact that they both reference the same reference to $pest explicit, with the implication that this was a deliberate choice for them to have the same value.

It's remarkably difficult to be precise about this! I think I've covered the alternates you're likely to hear at this point, and it's taken quite a number of edits to be precise.

Replies are listed 'Best First'.
Re^2: What's Really in a Reference?
by Xiong (Hermit) on Jul 17, 2010 at 05:48 UTC