Re: [ANN] HOM paper available
Re: [ANN] HOM paper available
- Subject: Re: [ANN] HOM paper available
- From: Marcel Weiher <email@hidden>
- Date: Mon, 12 Sep 2005 00:18:42 +0100
On 12 Sep 2005, at 00:08, Charlton Wilbur wrote:
On Sep 11, 2005, at 6:47 PM, Marcel Weiher wrote:
That said, you probably need a dynamic messenger with something
akin to #doesNotUnderstand: or -forwardInvocation: to build HOM,
or a true MOP that allows you to play with these sorts of things
in the compiler. I am not sure how you would do it with code-
blocks and/or first-class subroutine, but, once again, I am not
that familiar with Perl.
Perl also has AUTOLOAD, which is a method that (if defined) is
called when an undefined method is invoked, akin to -
forwardInvocation:. It would be trivial to add a higher-order
messaging construct to Perl by hooking into AUTOLOAD, though you
might have a problem in that there's no standard Perl class library
and thus you can't just hook into the base object class.
Hmm...so it sounds somewhat difficult.
Perl also has source filters, which let you reconfigure the
language any way you see fit. It would be trivial to add a higher-
order messaging construct to Perl using a source filter.
Not sure I would consider this trivial...heck, if you add a pre-
processor, you can do all sorts of stuff, but that wasn't the point.
For sufficiently narrow definitions of HOM, Perl doesn't have it;
though given the map, grep, and foreach operators (all of which
take code blocks as arguments) I'd argue that sufficiently narrow
definitions of HOM aren't useful.
Well, I would argue this is not the case: HOM is *very* specific, it
means Higher Order *Messaging*, ergo a message that takes a message
as in argument. As the paper points out, something like blocks in
Smalltalk is not HOM, it is a mechanism that uses, effectively,
Higher Order Functions.
Both can allow collection-processing and other related jobs, but they
do it differently, and the paper tries to show how the two are
distinct. I think you're trying to lump them all back together again.
While it is OK to see all these different mechanism as a kind of
"higher order" functionality, it does no good at all to describe them
all as HOM.
outputSet = [[inputSet collect] costIsLessThan: 30];
and it's tremendously useful; but in Perl I'd just say
@output = grep { $_->costIsLessThan(30) } @inputSet;
and, as the paper points out, you would say
outputSet := inputSet collect: [ :each | each costIsLessThan: 30 ].
in Smalltalk. However, that doesn't make the Smalltalk mechanism a
HOM...
And I could even do that without having to have a costIsLessThan:
message implemented:
@output = grep { $_->cost < 30 } @inputSet;
Again, just as in Smalltalk:
outputSet := inputSet collect: [ :each | each cost < 30 ].
And once again, this isn't HOM. Which isn't good or bad, by the
way. Just different.
Cheers,
Marcel
_______________________________________________
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