PackageDescription: HigherOrderMessaging
Higher Order MessagingLast published: November 1, 2002 by 'michael'
Defines 6 Classes
Extends 10 Classes
This package extends the normal Smalltalk iteration protocol to include some Higher Order Messaging protocols.
HOM is the brain-child of Marcel Weiher who implemented it in Objective-C. Obj-C doesn't have a strong iteration paradigm like Smalltalk does, so it was a needed concept. Here in Smalltalk land it's more of a novelty to see how far we can push the messaging paradigm.
This implementation of HOM is done by Michael Lucas-Smith and Travis Griggs. Enjoy.
Marcel Weiher's presentation on HOM can be found here: http://www.metaobject.com/papers/HOM-Presentation.pdf
And his website is here:
http://www.metaobject.com
Possible future extensions to the HigherOrderMessaging package could be support for Dictionary's.
Examples of HOM in use:
Smalltalk: aCollection do: [:each | each printString]
HOM: aCollection do printString
Ward-HOM: aCollection do: #printString
Smalltalk: aCollection collect: [:each | each age > 16]
HOM: aCollection collect age > 16
Smalltalk: aCollection collect: [:each | each printString]
HOM: aCollection collect printString
Ward-HOM: aCollection collect: #printString
Smalltalk: aCollection select: [:each | each age > 16]
HOM: aCollection select age > 16
Smalltalk: aCollection reject: [:each | each age > 16]
HOM: aCollection reject age > 16
Smalltalk: (aCollection select: [:each | each age > 16]) collect: [:each | each name]
HOM: (aCollection select age > 16) collect name
Ward-HOM: (aCollection select: [:each | each age > 16]) collect: #name
To unwrap the HOM object for situations where you wish to return the newly created collection, use the following kind of code:
peopleOverTheAgeOfFifty: people
^(people select age > 50) value