This is the mail archive of the guile@cygnus.com mailing list for the guile project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
[ sorry for broken threading and not quoting the original -
I'm just faking a proper reply ]
If I understood you right, here is how you do it in Pint.
I) Via "mapping methods"
A "mapping method" is a method that expects an interface mapping
as it first argument (instead of an interface). The primary use
of mapping methods is exactly construction. See the info manual
for more (and BTW feel free to complain if you don't understand
something).
If you want the first argument to be an interface and not a mapping,
just define a trivial wrapper function like this:
(define (make-by-obj obj . rest)
(apply make ;; your interface mapping method
obj
rest))
II) Via "mapping generics"
A "mapping generic" is like regular interface generic, but takes
a mapping as its first argument (like "mapping method").
It's good if the objects you want to dispatch on are not in the
same "class hierarchy" and so I) is not applicable.
HTH,
mike.