• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: why Obj-C
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: why Obj-C


  • Subject: Re: why Obj-C
  • From: "David W. Halliday" <email@hidden>
  • Date: Tue, 09 Apr 2002 20:45:55 -0500
  • Organization: TNRCC

Ondra Cada wrote:

> On Tuesday, April 9, 2002, at 03:28 , John C. Randolph wrote:
>
> > Back when I first learned Obj-C, I was of the opinion that C++'s method
> > call syntax was better(which it's not) because it was more in the style
> > of C (which it is). What changed my mind was realizing that Obj-C
> > expressions can *nest*, as in:
> >
> > foo = [[MyClass alloc] initWithSomeOtherObject:[OtherClass randomObject]]
> > ;
>
> You can construct something similar, though ugly (well, in *my* opinion
> those dots/arrows are ugly _anywhere_):
>
> foo=MyClass.alloc().initWithSomeOtherObject(OtherClass.randomObject());
> foo=MyClass->alloc()->initWithSomeOtherObject(OtherClass->randomObject());
>
> IMHO though there is an EXCELLENT reason to use [...]: the dot serves for
> _accessing entrails of structs_. Therefore it is quite right that C++ (and
> even Java) uses it, since its "methods" are, in fact, just functions
> stored in structs, and nothing more (which applies to virtual ones as well)
> .
>
> Though, we *ARE NOT* accessing anything: we are *SENDING MESSAGES* instead.
> That is an utterly new thing, absolutely unknown in any other C-based
> language (so far as I can say), and utterly DIFFERENT from accessing any
> struct! Therefore it very definitely deserves a specific language
> construction.

Actually, I have found this to be the /greatest/ reason for using a different
syntax (besides keeping the syntax from colliding with other aspects of the C [or
C++] language). When humans learn something new, it can cause confusion if it
/looks/ like something they think they already know. Having the new thing /look/
new helps the learner to make the shift in their thinking. (How many C++
programmers /think/ they are doing Object Oriented programming simply because they
are using things called "classes", when, in reality, they are simply doing
procedural programming, or, maybe, modular programming?)

> ...
> ---
> Ondra Cada
> ...

email@hidden
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.

References: 
 >Re: why Obj-C (From: Ondra Cada <email@hidden>)

  • Prev by Date: Distributed Objects: IP #'s vs. hostnames
  • Next by Date: window visibility question
  • Previous by thread: Re: why Obj-C
  • Next by thread: Re(2): why Obj-C
  • Index(es):
    • Date
    • Thread