Re: Objective-C and it's future
Re: Objective-C and it's future
- Subject: Re: Objective-C and it's future
- From: email@hidden
- Date: Sat, 8 Jul 2006 08:02:23 -0700
On 平成 18/07/08, at 4:10, Thomas Davie wrote:
On 8 Jul 2006, at 02:54, Sherm Pendley wrote:
On Jul 7, 2006, at 9:40 PM, Thomas Davie wrote:
I've yet to spend any time tracking down runtime bugs that were
not a "logical flaw" (i.e. me misinterpreting my model for how a
program should run) when writing a Haskell (strongly typed
functional language) program.
Well, if Haskell's has everything you want, why not just use Haskell?
<http://hoc.sourceforge.net/>
I didn't know that existed - but it does appear that it hasn't been
updated since panther was released :(
This at least shows that there's nothing we're doing with Cocoa
that inherently needs a weakly typed language, so why are the
constraints not added?
Really? (I will be on topic as this is relevant to cocoa)
Then how does Key-Value-Bindings/Key-Value-Coding work? How would you
switch an intermediate proxy class for the real thing in a strongly
typed language?
Imagine your array that you wanted to ensure was "the right class" so
you make sure that it can only contain "MyPerson" class.
When you invoke a key-value-coding method, to get some "Persons" like
[anArrayOfPeople mutableSetValueForKey:"persons"] and you restrict your
resulting array to only allow class of "MyPerson" you would run
afoul. Thats because mutableSetValueForKey and other KVC methods
return proxies.
The reason proxies are used is that they allow custom logic to be
used if one has defined methods that act for custom data. So if I
told each item in the
array [setValue:@"blablabla" forKey:@"name"] it would invoke the
custom logic for the value name (setName:) if it exists for each
object. But note, you don't have to care
if the object you are sending a value to has custom logic (so you
don't need to call setName:). Furthermore, using proxies allows the
framework designers
to add more functionality easily - if the future coredata allowed
remote database access, it would most likely be transparent to the
framework user in this case because the
proxy would handle traversing the network. It isolates you from a lot
of "generic" work.
In the past few years cocoa has evolved tremendously from a base
functionality point of view, all without adding to (complicating) the
language.
This is key IMO. The language is simple, elegant, and allows for so
much flexibility that a lot can be done just by adding to the
runtime, not
by adding tons of complicated syntax.... and all without an ugly/slow
VM too!
IMHO generics is overrated. Use cocoa/objective-c more, and you might
agree.
Andre
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