Fundamental question about visibility

W

WW

Shane said:
<http://www.nightflight.com/foldoc-bin/foldoc.cgi?method>

"The name given in Smalltalk and other object-oriented languages to a
procedure or routine associated with one or more classes. An object of
a certain class knows how to perform actions, e.g. printing itself or
creating a new instance of itself, rather than the function (e.g.
printing) knowing how to handle different types of object."

Sounds like a virtual function to me. Actually, FOLDOC also mentions
the concept of a "class method" -- that's a static member function, of
course.

Given this, one might say that it is incorrect to use "method" to
describe a non-virtual member function, although I have yet to find
any such use to be confusing or misleading, so I don't even bother
bringing that up. I might almost mention it if a non-member function
were called a method, though.

Method has no definition in a C++ discussion. It can only cause
imprecision, confusion and misunderstanding.
 
G

Gavin Deane

jeffc said:
Riiiiiiight, Mr. Pedant. No one had a problem with the OP's question except
you. Now, who wasn't here to help, but to display his dictionary knowledge
of the C++ language?

How do you know how many other people also had an objection to the use
of 'method' but elected not to mention it after WW had already brought
it up?

And how does the exchange between the OP and WW which ended with the
OP's problem solved lead you to conclude that WW wasn't helping?
 
A

Attila Feher

Gavin Deane wrote:
[SNIP]
How do you know how many other people also had an objection to the use
of 'method' but elected not to mention it after WW had already brought
it up?

And how does the exchange between the OP and WW which ended with the
OP's problem solved lead you to conclude that WW wasn't helping?

He does not conclude. He prejudges.
 
J

jeffc

WW said:
BTW NICE SNIPPING! How come you have snipped out that Steve Dewhurst's book
(C++ Gothcas) exactly my advice: do not use the word method in C++
discussions? Ah. Because that was showing that all you do is troll to
practice your ego.

Because you're a pedant.
 
J

jeffc

Gavin Deane said:
How do you know how many other people also had an objection to the use
of 'method' but elected not to mention it after WW had already brought
it up?

I'd argue with all the pedants. Anyone who wastes a post telling someone
else that "method is not part of the C++ standard language! nyah nyah!" has
a stick way too far up their rear.
 
J

jeffc

Gavin Deane said:
And how does the exchange between the OP and WW which ended with the
OP's problem solved lead you to conclude that WW wasn't helping?

The part about the method was completely unhelpful. He was just saying it
to show off his book knowledge of detail unrelated to the question, so he
can appear authoritative, toe the party line, be part of the cool C++ geek
crowd, and waste space in the newsgroup. People like that are only
motivated partially by helping people. Terms like method are completely
valid when discussing C++ design and code, regardless of whether the word
appears in the C++ keyword list, or even the official standard. Just like
base class, parent class, and superclass can be used interchangably, even
though you won't find them in the language. Unlike some people, I'm not
sitting here with a steel rod up my butt waiting for the next time someone
uses the term superclass so I can pounce on them for using a word that
doesn't exist in the language.
 
N

Noah Roberts

WW said:
Please, if you *know* what method means in the realm of the C++ language...
by all means, post it here!

Methods are actions you may request that an object carry out. You
invoke 'methods' by passing 'messages'; methods are implementations of
messages. This is basic OO terminology that you learn in any
introductory text.

The problem with C++ is that when you pass a message to an object it is
not necissarily the one that carries out the action even if it has
overridden its parent's methods. This is only guaranteed if the method
is declaired virtual in *all* parents. I suppose this is why some
people would consider only virtual 'functions' to be methods and why
others would object to a "member function" being called a method at all.
This is also one of the reasons I find C++ does not quite apply the OO
paradigm (which can be a strength at times).

There is also the fact that all C++ "member functions" eventually get
altered to in fact be functions that accept class structs as arguments.
I myself don't believe this should have an impact on our terminology
as it is an implementation detail that the programmer never really sees.
In other OO languages the term method is used and they also get
altered by the compiler to have a more function like signature. For
example Objective-C works this way (many even just preprocess into C)
but we use OO terms not procedural terms.

In my opinion the *only* reason to call a method "member function" is
because it is what C++ programmer terminology uses; and of course
because there are some who will pretend not to know what you mean, go
off on some rant, and may never answer the question. The term
"function" is really not an OO concept and, in my opinion, it is a
mistake to use it as such.

NR
 
J

jeffc

Noah Roberts said:
Methods are actions you may request that an object carry out. You
invoke 'methods' by passing 'messages'; methods are implementations of
messages. This is basic OO terminology that you learn in any
introductory text.

The problem with C++ is that when you pass a message to an object it is
not necissarily the one that carries out the action even if it has
overridden its parent's methods. This is only guaranteed if the method
is declaired virtual in *all* parents. I suppose this is why some
people would consider only virtual 'functions' to be methods and why
others would object to a "member function" being called a method at all.
This is also one of the reasons I find C++ does not quite apply the OO
paradigm (which can be a strength at times).

There is also the fact that all C++ "member functions" eventually get
altered to in fact be functions that accept class structs as arguments.
I myself don't believe this should have an impact on our terminology
as it is an implementation detail that the programmer never really sees.
In other OO languages the term method is used and they also get
altered by the compiler to have a more function like signature. For
example Objective-C works this way (many even just preprocess into C)
but we use OO terms not procedural terms.

In my opinion the *only* reason to call a method "member function" is
because it is what C++ programmer terminology uses; and of course
because there are some who will pretend not to know what you mean, go
off on some rant, and may never answer the question.

Now that is the voice of reason. Having said all that, it's pretty clear
why we don't have to post a whole page like this just because someone in
this newsgroup uses the term "method".
 
W

WW

jeffc said:
I'd argue with all the pedants. Anyone who wastes a post telling
someone else that "method is not part of the C++ standard language!
nyah nyah!" has a stick way too far up their rear.

Stop trolling!
 
W

WW

Noah Roberts wrote:
[SNIP]
Methods are actions you may request that an object carry out. You
invoke 'methods' by passing 'messages'; methods are implementations of
messages. This is basic OO terminology that you learn in any
introductory text.

That is the meaning of method in OO. What is the meaning of method in C++?
The problem with C++ is that when you pass a message to an object it
is not necissarily the one that carries out the action even if it
has overridden its parent's methods. This is only guaranteed if
the method is declaired virtual in *all* parents.

That is one interesting issue. The other is that in C++ freestanding
functions (due to ADL and operator overloading) may very well be considered
part of a class types interface.
I suppose this is why some people would consider only
virtual 'functions' to be methods and why
others would object to a "member function" being called a method at
all.

And this is already a source for confusion.
This is also one of the reasons I find C++ does not quite
apply the OO paradigm (which can be a strength at times).

C++ is multiparadigm.
There is also the fact that all C++ "member functions" eventually get
altered to in fact be functions that accept class structs as
arguments. I myself don't believe this should have an impact on our
terminology as it is an implementation detail that the programmer
never really sees.

Unless he starts to do tricks, like calling a member directly from C or
assembly. I saw that being done in an allegedly portable system. :) "Why?
The this pointer is the first argument, everybody knows!" Nice parallel to
stating that method has a well defined meaning in C++.

In other OO languages the term method is used and they also get
altered by the compiler to have a more function like signature.

That is OK. They did include the term method into their vocabulary and
defined its meaning. It is not done for C++.
For example Objective-C works this way (many even just preprocess
into C) but we use OO terms not procedural terms.

Does nto have much to do with why it is wrong in C++. For example in
English fast is an OK word. The same word in Hungarian means "the private
parts of a man". So does that mean we should bad the word from English?
Nope. Does that mean we should not use it in Hungarian? Only if you don't
want to get into trouble. But unfortunately (and not talking about yuou
here Noah) some people problems with the sizeof(privates) and so they spend
their time by trolling here and show up contiguous series of knee-jerk
reactions.
In my opinion the *only* reason to call a method "member function" is
because it is what C++ programmer terminology uses;

Method is an operation supported by a classes interface. Therefore method
and member function are not interchangeable. In C++ (using the OO
terminology) freestanding operator functions found by the argument dependent
name lookup are part of the interface provided by the object. And they are
not member functions. For one.
and of course because there are some who will pretend
not to know what you mean, go off on some rant,
and may never answer the question.

Really? How about they *don't* know what do you mean? Or they do, and give
you the answer which is *wrong* for you, because they do NOT understand the
word the same way as you do? Remember the thread where the greenhorn asked
"what methods does the C++ compiler automatically generate for us". Picking
up the *only* closest-thing-toi official-but-still-far-from-it note as a
defintion - where Bjarne Stroustrup that some peoplecall *virtual* member
functions methods - the answer is *NONE*. Not one method is generated.
The term "function" is really not an OO concept and,
in my opinion, it is a mistake to use it as such.

Sure. So don't use it in OO. Here we discuss the C++ language, not OO.
 
W

WW

jeffc wrote:
[SNIP]
Now that is the voice of reason. Having said all that, it's pretty
clear why we don't have to post a whole page like this just because
someone in this newsgroup uses the term "method".

On the contrary. The above snipped post is filled with technical
inaccuracies, tries to mix OO and C++ terminology (while C++ is
multiparadigm) and absolutely fails the task to define the term method in
the realm of the C++ language.

jeffc, stop trolling!
 
J

jeffc

WW said:
Noah Roberts wrote:
[SNIP]
Methods are actions you may request that an object carry out. You
invoke 'methods' by passing 'messages'; methods are implementations of
messages. This is basic OO terminology that you learn in any
introductory text.

That is the meaning of method in OO.

We discuss OO here. C++ is an OO language.
That is OK. They did include the term method into their vocabulary and
defined its meaning.

One can only imagine you hiding your dictionaries under your mattress, and
reading them late at night with a flashlight.
 
W

WW

jeffc said:
WW said:
Noah Roberts wrote:
[SNIP]
Please, if you *know* what method means in the realm of the C++
language... by all means, post it here!


Methods are actions you may request that an object carry out. You
invoke 'methods' by passing 'messages'; methods are implementations
of messages. This is basic OO terminology that you learn in any
introductory text.

That is the meaning of method in OO.

We discuss OO here. C++ is an OO language.

C++ is a multiparadigm language, not an OO one.
One can only imagine you hiding your dictionaries under your
mattress, and reading them late at night with a flashlight.

Stop trolling! Last warning.
 
J

jeffc

C++ is a multiparadigm language, not an OO one.

So, just for the record, you are saying C++ is not an OO language?
Stop trolling! Last warning.

<snicker> Now, back to your mattress, flashlight, and dog-eared copy of
Proceedings of the C++ Conference, 1994.
 
W

WW

jeffc said:
So, just for the record, you are saying C++ is not an OO language?

C++ is a multiparadigm language.
<snicker> Now, back to your mattress, flashlight, and dog-eared copy
of Proceedings of the C++ Conference, 1994.

Stop trolling!
 
A

Attila Feher

jeffc wrote:
[SNIP]
We discuss OO here.

We discuss the C++ language here, as defined by its standard. Not OO. That
is comp.object. I start to get the feeling you are also posting there.
With the name TopMind.
C++ is an OO language.

C++ is a multiparadigm langauge.
One can only imagine you hiding your dictionaries under your
mattress, and reading them late at night with a flashlight.

Get a life.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,582
Members
45,065
Latest member
OrderGreenAcreCBD

Latest Threads

Top