On Wed, Aug 12, 2009 at 10:49 AM, brianp <[email protected]> wrote:

>
> Thanks for the clarification everyone!
>
> I wouldn't have expected it to have different meaning depending on he
> object/class type. I'll keep an eye out for that.
>
> On Aug 12, 9:40 am, Marnen Laibow-Koser <rails-mailing-l...@andreas-
> s.net> wrote:
> > Frederick Cheung wrote:
> > > On Aug 12, 4:37 pm, Marnen Laibow-Koser <rails-mailing-l...@andreas-
> > > s.net> wrote:
> > >> are methods in Ruby. Not all methods are operators, but that's another
> > >> syntactic issue.
> >
> > > If we're being pedantic, then not all operators are methods: ! is not
> > > a method, nor is ?: and != is hardwired to be the negation of ==
> > > (there are a few others eg &&, :: et.)
> >
> > Ack, you're right.  I keep forgetting that unlike Smalltalk or C++, not
> > *every* operator is a method call.  Sorry about the error.  (However, <<
> > *is* both.)
> >
> > Best,
> > --
> > Marnen Laibow-Koserhttp://www.marnen.org
> > [email protected]
>

Yes, everything in Smalltalk is a method or commonly referred to as a
message that's always
sent to an object.  However, in C++, everything can be thought of as a
method but a method in
C++ can have further semantic meanings because it was derived from C.  For
example,

if I say write a method, one tends to think within a class using a message
passing style
if I say write a function, one tends to think of a C style representation
using a non-message
passing style sometimes

Next, one cannot overload the C and C++ operators within C++:  '.', '?:',
'sizeof', '::', and
'.*'.  Although, they are technically considered operators within the
language.

In short, I tend to think of operators as a specialized class of methods
which have been derived
from non-alphabetic characters and they have their particular usage
constraints.  Also, the use of
the word, method, means semantically different things
in different languages.

-Conrad

 <[email protected]>
> > --
> > Posted viahttp://www.ruby-forum.com/.
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Talk" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to