On Nov 4, 9:33 am, Joe Strout <[EMAIL PROTECTED]> wrote: > On Nov 3, 2008, at 5:27 PM, Marc 'BlackJack' Rintsch wrote: > > > Maybe this is a surprise for you, because we haven't discussed this in > > much detail in this group lately, but it applies to Python which does > > call-by-object or call-by-sharing. ;-) > > There's no such thing. Those are just terms made up by the Python > community to in place of the more standard "call-by-value" terminology > to make Python seem more mysterious than it really is. I guess you > can call it "purple bananas" if you want, but the behavior is exactly > the same as what every other language calls call-by-value. > > But I really am trying not to continue this debate. So that's my last > reply about it for tonight, I promise. :) > > Cheers, > - Joe > <http://www.strout.net/info/coding/valref/>
I'm fed up with you. In Von Neumann Architecture computers, only pass-by-value is natively supported. Other idioms are made on top of pass-by-value. That's why exclusively pass-by-value languages like C is most flexible than other exclusively pass-by-<insertanythinghere>. BUT the difference is clear, if you want to do pass-by-reference in C (I prefer to call it faux pass-by-reference), you'd have to manually find a variable's address, pass it by-value, then dereference the address. Compare with VB's ByRef or C++'s &, which does all that _automatically_ for you behind the scene. Another example: pass-by-object. I disagree with the term pass-by- object-reference, since the notion of object reference is unnecessary in a true pass-by-object mechanism (i.e. we should travel outside VNA realm for a true pass-by-object mechanism). Problem is: I'm not aware of any computer architecture that can accommodate pass-by-object natively or whether such architecture is feasible to be made. Solution: Emulate such architecture on a VNA computer. Limitations: pass-by-object implementation on a VNA computer requires the notion of object reference/pointer because VNA computers cannot pass object, it can only pass numbers. In pass-by-object, the whole object is passed around, not a copy of the object like in pass-by-value or a copy of the pointer to the object like in faux pass-by-reference. This makes pass-by-object actually closer to pass-by-reference than to pass-by-value, since the notion of VNA's requirement for Object Reference means passing pointers around. But don't let it confuse you, the pass-by-object mechanism itself does not recognize Object Reference, unlike pass-by- reference recognition of reference/pointer. Now that I have clearly defined the line between pass-by-object and pass-by-value, I'm left with you thinking what's the difference between pass-by-object and pass-by-reference. In pass-by-reference, names are _mnemonic to location in memory_. In pass-by-object, names are _mnemonic to objects_. In pass-by-reference, when we assign a value to the name, we'd assign a value _to the location in memory_. In pass-by-object, when we assign a value to the name, we assign an object _to the name_. When passing parameters, pass-by-reference systems passed the memory address and alias that memory address to a local name. In pass-by-object system, since the object itself has no idea of its own name, so it is rebound to a local name. You can say that pass-by-reference system is memory-location-centered, while pass- by-object system is name-centered. To summarize, the key bit you're missing is built-in _automatic_ abstraction from pass-by-value. All pass-by-<insertanything> except pass-by-value is an emulation over an architecture that can only natively pass-by-value. pass-by-reference is emulated in C, C++, and VB by passing memory address/pointer but C isn't a by-ref system because C doesn't provide the automatization. What makes python's parameter passing called as pass-by-object is because python provides the automatization to make it seems that you can do true pass-by- object. -- http://mail.python.org/mailman/listinfo/python-list