discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: PROPOSAL: Objective-C++


From: Helge Hess
Subject: Re: PROPOSAL: Objective-C++
Date: Tue, 20 Nov 2001 09:59:10 +0100

David Relson wrote:
> >I personally like
> >
> >[array makeObjectPerformSelector:@selector(doSomething)];
> 
> Eric,
> 
> Yep.  That's another way to skin the same cat.  However,
> makeObjectPerformSelector: requires defining an additional method.

Well, HOM removes that requirement. It's just

  [[array do] doSomething];

...

The implementation concept is pretty easy, the object returned by "do"
catches the "doSomething" invocation and executes it on the source
object.

The major problem I have with this approach is, that it requires a
working NSInvocation, which is difficult to have on all platforms ...

> Using
> blocks does it inline, which I consider a bit easier.  Also, blocks can
> have two arguments.  For example to sort an array one could use:
> 
> array = [ array orderedBy: [ :a :b | [ a lt: b ]]];

You can also have as much parameters as you like in HOM.

Greetings
  Helge
-- 
SKYRIX Software AG - http://www.skyrix.com
Web Application Technology for Enterprises



reply via email to

[Prev in Thread] Current Thread [Next in Thread]