haskell - Typeclasses in Common Lisp -
i'm wondering if there's way emulate haskell's typeclasses
in common lisp.
generic functions allow overloading
, , it's possible define types using deftype
(which defined membership list of instances, example).
but can't dispatch
on type. there way make class subclass(and subtype) of other class after definition(e.g. making cons
class subclass of sequence
class, without redefining cons
)?
thanks.
type classes in haskell means statically implementations "interfaces" in form of dictionaries (similarly how vtables in e.g. c++ used (almost) statically, unlike c++ dynamic dispatch @ runtime). common lisp dynamically typed language such lookup make no sense. can implement own of "type class" implementations (instances) @ runtime — design not hard imagine in language expressive common lisp.
p.s. python's zope has adaption mechanism similar charactetistics, if feel referring existing solution in dynamic setting.
Comments
Post a Comment