Hi. > Am 06.02.2021 um 16:14 schrieb Luís Oliveira <luis...@gmail.com>: > > On Sat, 6 Feb 2021 at 13:46, Manfred Bergmann <manfred.bergm...@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. :-)
OK. I kind of get it. To simple to be visible. :) But this is kind of also possible in i.e. Java where you can say: Foo.class.newInstance() which uses reflection and is not normally used. But is effectively similar to make-instance `foo. And yet Abstract Factory pattern in Java exists and is usually done using parallel hierarchies, as he describes. Manfred