I haven't studied Smalltalk or Strongtalk and am just trying to get an overview of the semantics of interfaces and polymorphism in O/O languages, particularly Dart.

In the 2002 paper titled Mixins in Strongtalk, there is the following paragraph in the section Copying Down Methods :

If a mixin represents a class declaration, then we associate the mixin with its master invocation, which is the class from which the mixin is derived. The master invocation is stored in an instance variable of the mixin. Any invocation can check if it is the master by examining its mixin and seeing if the master is identical to itself.

How does the master know what is its mixin? Does it store a reference to its mixin, and if so, how does it come about that an arbitrary class definition happens to contain this information? After all, isn't the idea that a mixin is derived from a class which was not intended, per se, to be used as/for a mixin?

I hope this makes sense.

  • 1
    Note: I don't know the answer to your particular question, but I wanted to point out a logical flaw in your reasoning: just because the author of a class didn't intend for it to be used as a mixin doesn't mean that the author of the VM can't be prepared for the possibility of a class being used as a mixin and add a mixin field to the class struct. The Animorphic VM, the VM for Strongtalk, is completely aware of mixins, in fact, it is completely mixin-based instead of class-based like most other Smalltalk VMs (which BTW made it so suitable as the basis of V8). – Jörg W Mittag Nov 26 '15 at 9:20
  • Have you considered asking this question in SO? – Leandro Caniglia Nov 26 '15 at 13:53
  • Thanks, Jorg. Something for me to chew on when I have more familiarity and can ask a more informed question. BTW, shouldn't it be called "anamorphic" with an "a"? – Tom Russell Nov 27 '15 at 22:18
  • Well, that's what the company decided to call it (and themselves) :-D I guess it's a play on monomorphic, duomorphic, polymorphic, megamorphic and the fact that due to the aggressive optimizations, the VM was able to run highly polymorphic and even megamorphic code as fast as other VMs run monomorphic code. Fun fact: the Animorphic VM was the fastest dynamic language VM on the planet. Fun fact 2: the HotSpot JVM still is basically just a slightly modified version of the Animorphic Smalltalk VM, albeit heavily developed since then. – Jörg W Mittag Nov 28 '15 at 10:58
  • 1
    @LeandroCaniglia: His question is a better fit here. – Robert Harvey Nov 28 '15 at 20:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.