Re: [ANN] HOM paper available
Re: [ANN] HOM paper available
- Subject: Re: [ANN] HOM paper available
- From: Charlton Wilbur <email@hidden>
- Date: Sun, 11 Sep 2005 19:08:26 -0400
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.
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.
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. Of course, Perl has that
considerable richness of operators and constructs, and I suspect that
HOM wouldn't be nearly as useful in Perl as it is in Objective-C,
because of the comparative paucity of constructs in Objective-C.
In other words, I need HOM in Objective-C to do something like:
outputSet = [[inputSet collect] costIsLessThan: 30];
and it's tremendously useful; but in Perl I'd just say
@output = grep { $_->costIsLessThan(30) } @inputSet;
And I could even do that without having to have a costIsLessThan:
message implemented:
@output = grep { $_->cost < 30 } @inputSet;
Of course, I could always define a collect method in a collection
class, so we can keep some sort of object-focused orthodoxy, and the
following syntax could also be made to work:
$outputSet = $inputSet->collect->costIsLessThan (30);
Charlton
--
Charlton Wilbur
email@hidden
email@hidden
_______________________________________________
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