On 9/5/17 1:02 PM, Steve D'Aprano wrote: > On Tue, 5 Sep 2017 11:37 pm, Gregory Ewing wrote: > >> Dennis Lee Bieber wrote: >>> Pascal, probably Modula-2, Visual BASIC are closer to the C++ reference >>> semantics, in that the definition of a function declares how the >>> argument(s) are passed. >> Well, sort of. In Pascal and Modula, and also VB I think, >> parameters are the only things that can be declared as having >> reference semantics, whereas references in C++ are first-class >> things that can be stored in any variable. > No, they aren't first-class.
Did you mis-read Gregory's claim? He said, "references *in C++* are first-class things". You seem to be talking below about Python things. > > - It is not possible to refer to a reference after it is defined; any > occurrence of its name refers directly to the object it references. > > - Since you cannot refer directly to a reference, but only the object > it points to, you cannot have a reference to a reference. > > - Containers of references are not allowed. > > - Once a reference to an object is created, it cannot be changed to > reference another object ("to be reseated"). > > The last is only a limitation if you think of references as mutable pointers > in > the C sense. But if you think of them as objects in the Python sense, that > makes them merely immutable. > > But the inability to refer to the reference itself, the lack of references to > references, and the inability to have a container of references, makes them > second-class values -- or possibly not values at all. > > (I don't know enough about C++ to distinguish between the last two opinions, > but > I'm strongly leaning towards "not values at all".) > > > -- https://mail.python.org/mailman/listinfo/python-list