Mailing Lists: Apple Mailing Lists
Image of Mac OS face in stamp
Re: a question about "->"
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: a question about "->"



On 5 Jul 2010, at 20:51, Hamish Allan wrote:

> On Mon, Jul 5, 2010 at 2:10 AM, Ian Joyner <email@hidden> wrote:
>
>> The simple fact is that C exposes implementation details all over the place.
>> This is bad
>> ...
>> C is the root cause of most of today's computing problems
>
> C is portable machine code.

Like any compilable language actually (or even interpreted code).

> It's designed to expose implementation
> details.

Don't know if it was designed to, but it just happens to.

> Every high-level language you use, at the end of the day,
> runs on a machine that needs to differentiate between values and
> pointers. If "a->b" didn't exist, you'd have to write "(*a).b", and
> you'd still have to make changes across your entire codebase if you
> decided to change the level of indirection of a variable. How would
> you design a language to expose these levels of indirection which did
> not require such changes?

That's really easy.

obj A { b }

A a;  // This a just goes on stack

To access b:

a.b

A *a; // This goes on heap

To access b:

a.b

Just the same. The compiler is smart enough to know one is on the stack and one is in the heap. Programmer changes mind compiler generates correct access code. There really is no need for two access operators that do the same thing, just as there is no need to have Objective-C objects declared with a * because everything goes on the heap anyway. If you could clean up these languages you'd get less irritating syntax errors, less programming exceptions and more reliable software, less need for common refactorings. All of these ills with the range of techniques with which you can undermine C to create viruses and worms means C is a weak base for any language. And yes it confuses new comers because it is confusing. C reminds me of the slides in WWDC 2010 session 103 showing the two urinals together so only one is usable, staircases on the outside of a building, and the non-balcony.
 _______________________________________________
Do not post admin requests to the list. They will be ignored.
Objc-language mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

References: 
 >a question about "->" (From: "Patrick J. Collins" <email@hidden>)
 >Re: a question about "->" (From: Thomas Davie <email@hidden>)
 >Re: a question about "->" (From: "Patrick J. Collins" <email@hidden>)
 >Re: a question about "->" (From: Ian Joyner <email@hidden>)
 >Re: a question about "->" (From: John Engelhart <email@hidden>)
 >Re: a question about "->" (From: Ian Joyner <email@hidden>)
 >Re: a question about "->" (From: John Engelhart <email@hidden>)
 >Re: a question about "->" (From: Ian Joyner <email@hidden>)
 >Re: a question about "->" (From: Hamish Allan <email@hidden>)



Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2011 Apple Inc. All rights reserved.