Python 3K or Python 2.9?

Bjoern Schliessmann usenet-mail-0306.20.chr0n0ss at spamgourmet.com
Thu Sep 13 14:21:44 CEST 2007


TheFlyingDutchman wrote:

> I am not talking about how the implementation of a C++ or Java
> compiler uses the this pointer/this reference internally. I am
> talking about how an author describes in English the "this"
> pointer/reference in their book on programming C++ or Java.

Ah, okay.
 
> I don't think you will find them saying that under the covers
> "this" was passed to the method (if in fact it is). They just say
> that it refers to the current object inside that object's method.

Mh, in my book, there is (quickly translated from german):

| Instance pointer (C++ only) 
| 
| The /this/ pointer is a feature of all non-static class methods.
| Every non static method is extended internally by a /this/
| argument. To that argument the compiler passes a pointer to the
| instance for which the method is being called.    
(Dirk Louis, C/C++-Kompendium, Markt&Technik-Verlag, 2000)

And that's only from the pointer chapter. The OOP chapters are more
detailed. And no, it's no book about compiler architecture, it's a
compendium.

> Here is a link to a tutorial where Sun is talking about the this
> reference:
> http://java.sun.com/docs/books/tutorial/java/javaOO/thiskey.html

That's a tutorial for getting you started, no reference
documentation or in-depth course.

> I am referring to C++. If someone is trying to learn the language,
> knowledge of the internal implemenation is counter-productive in
> my opinion because it distracts from the details they need to
> learn. 

In a language like C++ it is beneficial to know some inner
workings -- in the same way like it's beneficial to know some inner
workings of a computer if you want to use it.

BTW, C is not for nothing called "portable assembler" :)

> If they are experienced and want to learn about the internals to
> potentially help them code in the most blazingingly fast manner
> they ideally would just be reminded they are using C++ and not
> some slower byte-code executed language where it could possibly
> matter. ;) 

I don't know if it's just me, but I tend to understand stuff like
virtual methods much better if I know *why* they exist, and not
just *that* they do. That makes judging if and when I need them
easier.

Regards,


Björn

-- 
BOFH excuse #192:

runaway cat on system.




More information about the Python-list mailing list