I'm wrong or Will we fix the ducks limp?
On 09/06/2016 08:50, Antoon Pardon wrote:
> Op 08-06-16 om 19:29 schreef BartC:
>> I don't see why we should determine what a /proper/ reference
>>> can do, based on what it does in one specific language.
>> Because there are some things that such references can do that Python
>> can't do with its object reference model, not without some difficulty
>> or having to write convoluted code.
> So? Maybe you have the wrong idea of what a reference is/can do?
Maybe. Maybe in all the languages I've been implementing for three
decades have implemented references and pointers wrongly.
> A reference is an alias.
Not really. My address is not an alias for my house (the latter is a
2-storey brick building, the former is a few lines on an envelope). A
reference and what it refers to are a little different.
(What /I/ call an alias is demonstrated by a language feature I used to
implement like this:
int b @ a
a := 18
println b # 18
b := 21
println a # 21
Here, b is a synonym for a; another name for the same variable.)
> What you can do with that depends of the
> work environment. That you can do different things in an evironment
> that has a copy assignment than in an environment where you don't
> doesn't make the aliases go away.
Well, all my implementations of references and pointers meet Steven
D'Apranso' swap() challenge (see his post in this thread about 90
minutes before this one).
And in fact, my new languages have a built-in swap operator that
internally depends on the kinds of references that Python doesn't have.