• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: [ANN] HOM paper available
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [ANN] HOM paper available


  • Subject: Re: [ANN] HOM paper available
  • From: Marcel Weiher <email@hidden>
  • Date: Wed, 14 Sep 2005 10:25:49 +0100


On 13 Sep 2005, at 14:40, T Reaves wrote:


Using the above example

    alice do addReport: sally reports each;

would simply become

    alice do addReport: sally reports;

So here the HOM is 'alice do addReport:'; when combined with the standard message 'sally reports' you'd have a hybrid. Just because 'sally reports each' can be done as a HOM does not mean it should! ;) Here we have the ability to use a HOM to make it clear what we are doing to alice, while relying on the standard message to sally to get her reports. A good combination of both, i think.

OK, first some terminology. The HOM is 'do'. The argument message to the HOM is addReport:sally reports each. Of course, that is a nested expression, with 'sallly reports each' being evaluated and the result of that passed as an argument to addReport:. HOM is *always* combined with standard messages. Furthermore, 'each' itself is not a HOM.


So the actual argument message is 'addReport: <something>'. In normal circumstances, <something> is some sort of Person object. If we did what you suggest and leave out the 'each', <something> would be an array of person objects. Of course, this wouldn't work, because we would add an array object where we expect a single Person object.

So what needs to happen at some point is that the individual Person objects in the array returned by 'sally reports' are taken out and provided as arguments to individual sends of 'alice addReport:<aPerson>'. This is the task of the 'do' HOM, but the question is wether it should do this when presented with an array as an argument. Should do iterate over all arrays it finds in the argument message? I think the answer is no, for two reasons:

First, having such an automatic mechanism precludes ever using an array in a HOM and not iterating over it. I personally think this is quite a drastic limitation.

Second, you have no syntactic indicator in the source code that the argument is to be iterated over. This seems a bit too magical, and actually loses expressiveness IMHO.

While arguments can be made for automatic array iteration, I think the disadvantages outweigh the advantages, and it is better to have an explicit marker that indicates both syntactically and semantically 'this argument is to be iterated over'.

Cheers,

Marcel



--
Marcel Weiher                          Metaobject Software Technologies
email@hidden         www.metaobject.com
The simplicity of power            HOM, IDEAs, MetaAd etc.
        1d480c25f397c4786386135f8e8938e4


_______________________________________________ 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
References: 
 >[ANN] HOM paper available (From: Marcel Weiher <email@hidden>)
 >Re: [ANN] HOM paper available (From: "John C. Randolph" <email@hidden>)
 >Re: [ANN] HOM paper available (From: Marcel Weiher <email@hidden>)
 >Re: [ANN] HOM paper available (From: T Reaves <email@hidden>)
 >Re: [ANN] HOM paper available (From: Marcel Weiher <email@hidden>)
 >Re: [ANN] HOM paper available (From: T Reaves <email@hidden>)
 >Re: [ANN] HOM paper available (From: Marco Scheurer <email@hidden>)
 >Re: [ANN] HOM paper available (From: T Reaves <email@hidden>)

  • Prev by Date: Re: NSArrayController selectNext updating late
  • Next by Date: Re: Core data model - binding question
  • Previous by thread: Re: [ANN] HOM paper available
  • Next by thread: Re: [ANN] HOM paper available
  • Index(es):
    • Date
    • Thread