HOM - Higher Order Messages
Klaus D. Witzel
klaus.witzel at cobss.com
Thu Apr 20 05:40:39 UTC 2006
Hi all,
what about higher order messages with more than one argument, examples
"copy the first n elements from old to new array"
newArray #at: eachOf: (1 to: n) #put: withEach: oldArray
"conditionally copy n elements from old to new array"
newArray #at: eachOf: (1 to: n) #put:
withEach: oldArray onlyIf: [:index :element | element notNil]
When using colored syntax the hash sign can disappear in favor of a nice
color.
The term (newArray #at:) can be read like a Binary Higher Order Message,
both by the compiler and the developer. So eachOf: would be sent to
(newArray #at:), resp. eachOf:withEach: would be sent to (newArray
#at:put:). Only less is more ;)
The example from below would then be (imagine it very nicely colored)
alice #addReport: eachOf: sally reports
/Klaus
On Wed, 19 Apr 2006 14:38:43 +0200, Wolfgang Eder <edw at generalmagic.at>
wrote:
> Hello,
> what's wrong with:
> alice addReports: sally reports.
> Cheers, Wolfgang
>
>
> francisco.j.garau at jpmorgan.com wrote:
>> In Marcel's original paper it says:
>> alice addReport: sally reports each
>> I suggested:
>> alice addReport: sally reports all
>> Andreas is suggesting:
>> alice addReport: eachOf sally reports
>> I liked the last one. But it would be tricky to implement. We don't
>> want to introduce any change into the language, so "eachOf" should be
>> an object. The only responsibility of this object is to create a HOM
>> trampoline. Hold on. What if eachOf is actually a class (but with the
>> same trampoline responsibility as before). Then we would have:
>> alice addReport: EachOf sally reports
>> Ummhhh. Doesn't look very nice. Any of the first two alternatives
>> looks nicer to me - and very readable!
>> Blaine, I will look at the LazyCollections when I get a chance. Any
>> performance issues in your implementation?
>> Cheers, Francisco This communication is for informational purposes
>> only. It is not intended
>> as an offer or solicitation for the purchase or sale of any financial
>> instrument or as an official confirmation of any transaction. All
>> market prices,
>> data and other information are not warranted as to completeness or
>> accuracy and
>> are subject to change without notice. Any comments or statements made
>> herein do not necessarily reflect those of JPMorgan Chase & Co., its
>> subsidiaries and affiliates.
>>
>
>
>
>
More information about the Squeak-dev
mailing list
|