Front page | perl.perl6.internals |
Postings from August 2004
Re: Something to ponder
Thread Previous
|
Thread Next
From:
Felix Gallo
Date:
August 18, 2004 12:57
Subject:
Re: Something to ponder
Message ID:
20040818195705.GA7120@amse.pair.com
Dan writes:
> sub foo :come_from('+', int, int) {}
One problem with MMD in general, and return specifically, is
'what happens if multiple M match the same D requirements?
i.e.,
sub foo :come_from('+', int, int) { shift; shift builtin::+ shift };
sub bar :come_from('+', int, int) { shift; shift builtin::* shift };
If the answer is 'all get executed', this could be useful for
any languages interested in implementing aspect-oriented programming
as a first class language feature, e.g.
sub debug_log :come_from(:benchmark_me) {
my $function_name = shift;
print STDERR "debug: $function_name at " . time() . "\n";
}
sub notify_with_pager :come_from(:notify_me) {
...
}
sub foo :benchmark_me { ... } # gets benchmarked
sub bar :benchmark_me :notify_with_pager { ... } # benched and notified
sub baz { ... } # not so much with the benchmarking
If the answer is 'the second match is a syntax error'...well,
that spoils the fun, but who said talking about continuations was
supposed to be fun?
F.
Thread Previous
|
Thread Next