Sv: Re: [PEAK] Interfaces
gabriel.j at telia.com
gabriel.j at telia.com
Wed Jul 5 17:23:21 EDT 2006
There was some discussion here about interfaces recently and since I
work on the same project that Terry does I thought I would pipe in with
my questions.
Rather I am interested in the RuleDispatch stuff you pointed to using
Generic Functions to provide the visitor pattern.
I am a bit confused as to how it works when you have several things
that you wish to do with say a verb.
Our current system (unfinished) uses a chain of reaction where each
component of an object has to say that it doesn't object(no pun
intended) to the action being performed before they actually do what
they were designed to do. This is done with a simple try statement that
takes care of errors and execution. Any object can abort the chain.
What I need to know about the visitor pattern in your blog Phillip is
what it handles.
Say we want to just add a sentence if an action is performed.
@drink.when('target isDrinkable()')
drink(actor, target):
print 'glug glug'
@drink.when('target isDrinkable()')
drink(actor, target):
print 'ahhh'
Will this print:
glug glug
ahhh
or something entirely different?
Is it possible to overload some kind of default action for an object?
@drink.default('target isDrinkable()')
drink(actor, target):
print 'glug glug'
@drink.default('target isDrinkable()') -- this should be the new
default
drink(actor, target):
print 'you drink the liquid.'
Can generic functions be methods? Do methods have their own GF name
spaces?
Or is it truly generic?
Please exuse my total lack of understanding of what is what I haven't
been able to install peak it is quite frustrating.
Is Peak dependent on a specific gcc-package to install with distutils?
This is it for now I suppose I will have to explain what I mean
sometime soon.
More information about the PEAK
mailing list