Pattern, Abstract Factory / Factory
Luís Oliveira
luismbo at gmail.com
Sat Feb 6 15:14:27 UTC 2021
On Sat, 6 Feb 2021 at 13:46, Manfred Bergmann <manfred.bergmann at me.com> wrote:
> Does anyone know what Peter Norvig had in mind when he said that metaclasses can be used instead of Abstract Factory pattern?
Are you talking about slides 12 and 13? Peter does not mention
metaclasses there or anywhere else in his slides. I believe his point
is that make-instance is the factory. Classes are first-class values
and make-instance accepts a class as its first argument. If you use
qt-backend, gtk-backend, motif-backend classes, at some point you can
make the decision about which class to instantiate and pass it to
make-instance. He categorizes this pattern as invisible, which might
explain why you're having trouble seeing it. :-)
Cheers,
Luís
More information about the pro
mailing list