On Sun, Sep 22, 2019 at 09:08:18AM -0000, Nutchanon Ninyawee wrote:
Link is a language feature that allows multiple variable names to always refer to the same underlying object define in a namespace. For now, if the variable a link with b. I will denote as a >< b or link('a', 'b')
I don't know of any standard term for this, but I would call it aliasing. It is not quite the same as the version described here: https://en.wikipedia.org/wiki/Aliasing_%28computing%29 In Python terms, we would say that an alias makes two names refer to each other, rather than two names referring to a single object. In current Python: spam = [42, None] eggs = spam # Assignment (name binding) binds both names to the same object. assert spam is eggs # Mutations applied through one name affects the other name, # since they are the same object. spam.append("hello") assert eggs[-1] == "hello" # But re-binding of one name doesn't touch the other. spam = "something else" assert eggs == [42, None, "hello"] With a "name alias", the first two assertions would also apply, but the third would be different: spam = [42, None] eggs >< spam assert spam is eggs spam.append("hello") assert eggs[-1] == "hello" # But rebinding affects both names. spam = "something else" assert eggs == "something else" eggs = "it works in both directions" assert spam == "it works in both directions" Likewise unbinding: ``del spam`` would delete eggs as well, and vice versa. Is that what you had in mind?
More in detail on this link https://dev.to/circleoncircles/python-ideas-link-bidirectional-aliasing-in-p...
That's a nice explanation, although I disagree with some of your claimed benefits. BTW, your home page https://nutchanon.org/ is currently reporting a 404. -- Steven