[Prev][Next][Index][Thread]

Re: methods on make



Roman Budzianowski <Roman.Budzianowski@oracle.com> writes:

> What problem are you trying to solve ? If we assume that only one
> implementation can be active at one time (a reasonable assumption)
> the just reloading the new method will replace it, thus replacing an
> implementation.  (I am not sure fi my previous message got sent, so
> I may be repeating myself).

Another example is the make(...) implementation asks another generic
function passing various initialization parameters which can be
dispatched on to get the correct class type:

define method class-for-make-widget(class, somearg1 :: <x>)
  <foo-widget>
end;

define method class-for-make-widget(class, somearg1 :: <y>)
  <bar-widget>
end;

define method make(class == <widget>, #key #rest initargs)
  apply(make, class-for-make-widget(class, somearg1, somearg2), initargs);
end method make;

Chris.
-- 
http://www.double.co.nz/dylan



Follow-Ups: References: