A question on modification of a list via a function invocation
Rustom Mody
rustompmody at gmail.com
Fri Aug 18 08:36:12 EDT 2017
On Friday, August 18, 2017 at 8:37:43 AM UTC+5:30, Steve D'Aprano wrote:
> On Thu, 17 Aug 2017 11:19 pm, Rustom Mody wrote:
>
> > What is called ‘call-by-object’ or ‘call-by-sharing’ etc is really an
> > acknowledgement of the fact that parameter passing in the OO world along with
> > permissible mutation of data-structures is inherently leaky
>
>
> Leaky of *what*?
>
> What do you think the abstraction is that is leaky?
>
> Call by value leaks. The abstraction is that the argument received by the
> function is independent from the value you pass in. But the leak happens when
> you pass an array with a billion items, and the compiler makes a copy of the
> entire array, and you wonder why you run out of memory.
>
> Call by reference leaks. The abstraction is that the argument received by the
> function is the argument you pass to the function. Not just the same, in the
> sense of equal, but one-and-the-same. As in, "me myself and I" all refer to the
> same person. But the leak happens when you try to pass a literal or a constant
> or the result of an expression, rather than a variable, and the compiler
> says "Uh uh, you can't do that!"
>
> So what abstraction do you think call by object sharing is making, and in what
> way does it leak?
Data Dependency — also called coupling — is generally considered to be
deleterious to software quality
| The presence of pointers causes complex data-dependence
| relationships. Because of pointers and aliasing, it may not be possible to
| identify unambiguously the variable that is actually defined (resp., used) at a
| statement containing a definition (resp., use).
https://www.cc.gatech.edu/~orso/papers/orso.sinha.harrold.IWPC01.pdf
Python removes the frank pointers of C (like) languages
It does nothing about aliasing
Sharing-by-object is nothing more than the diginification of aliasing
More information about the Python-list
mailing list