Re: Function calling
Re: Function calling
- Subject: Re: Function calling
- From: Bob Ippolito <email@hidden>
- Date: Wed, 25 May 2005 18:32:16 -0700
On May 25, 2005, at 6:02 PM, Ondra Cada wrote:
On 26.5.2005, at 2:44, Thomas Davie wrote:
Nope. Strong typing is more or less irrelevant. There are only
two things it is good for:
(a) to check for programmer's mistakes;
(b) to allow for proper argument and return value automatic casting.
Both of them are *completely* compile-time, and (but for them
proper casting of (b)) have no run-time consequence at all.
Sorry for the multiple replies, but I must disagree. Strong
typing has a huge impact on the runtime because checks do not need
to be made in the runtime – we have already verified in the
typechcker that it will all work.
Wrong. The information compiler has is *principially and
profoundly* incomplete, and you cannot use it reliably -- just have
a look at Java or C++.
For example, compile-time you can't know what changes will be
caused by a category or by a poseAsClass:. Either you forbid such
things, which cripples the language to total unusability like
Java's, or you just have to live with the fact compile-time checks
are good for nothing (but catching a few typos).
That's only because Java and C++ are poorly designed. The cited
example, Haskell, does not have this problem. What you're saying
sounds like "Computers suck, look at Dell!".
poseAsClass: is bad example, it's almost never used and it doesn't
work particularly well. There's plenty of languages out there that
don't support this facility that are much more dynamic than Objective-
C is.
As for categories, there are plenty of programming languages that get
away just fine without them. Patching a class ad-hoc to do more
stuff is wrought with problems because the namespace is flat (like
the Objective-C class namespace, which also causes similar
problems). Categories are especially bad about this because they
provide no method for conflict resolution (other than separate
compilation units plus loading bundles at runtime, etc.). There
isn't even a way to detect that your category was loaded properly
unless you ship and run unit tests with your application!
I'm not saying categories are useless, as they're most definitely the
right solution to a lot of problems in Objective-C, but that doesn't
mean the concept is universal. There are definitely better ways of
doing similar things elsewhere.
It really just sounds like you fell in love with Objective-C a few
years ago, got burned by Java and C++, and haven't bothered to pay
attention to anything else :)
-bob
_______________________________________________
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