Re: Objective-C and it's future
Re: Objective-C and it's future
- Subject: Re: Objective-C and it's future
- From: Charlton Wilbur <email@hidden>
- Date: Fri, 7 Jul 2006 19:55:52 -0400
On Jul 7, 2006, at 7:33 PM, Thomas Davie wrote:
The most basic extension of the type system I can think of is to
allow something akin to generics, or ADTs to allow us to specify
such things as what type of object an array contains.
Dynamic typing means you don't *need* Java-style generics or C++-
style templates -- they are, after all, an attempt to give static
typing the flexibility of dynamic typing. Java needs generics so
that the compiler can determine what type an object is; Objective-C
punts the decision to runtime. This is not a mistake, but an
intentional design decision; the things that prevent you from doing
stupid things often also prevent you from doing brilliant things.
(Some might say -- and I am among them -- that C++'s inisistence on
static typing, and on all type decisions being made at compile-time,
is its single greatest design flaw. And Java, which could have
followed Objective-C's lead, followed in C++'s footsteps instead.)
To paraphrase a very wise man, if you want C++ (or Java), you know
where to find it.
On the other hand, I wouldn't mind explicit support in the language
for pre- and post-conditions, invariants, and other constraints, so
that the compiler and runtime could correctly infer that a type
mismatch had occurred.
So questions here really are (a) is there a more appropriate place
to post this, (b) opinions on Objective-C's type system.
(a) Probably. I'd recommend comp.lang.objective-c, if you can manage
to ignore a particularly egregious troll.
(b) Dynamic typing works well for this particular problem domain. I
don't see any real advantage to making the typing static except
reassuring people who aren't familiar with the Objective-C mindset,
and compromising one of Objective-C's strengths in order to do so.
Charlton
--
Charlton Wilbur
email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden