Created
December 10, 2017 22:16
-
-
Save smarr/cb8529892d6e4d72b43efd94a55d515e to your computer and use it in GitHub Desktop.
Mixin Issue Newspeak
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyModule platform: platform = ( | |
| private Transcript = platform squeak Transcript. | | |
) ( | |
public class A new = () ( | |
public mixinA = ( ^ #Amixin ) | |
) | |
public class B new = () ( | |
public mixinB = ( ^ #Bmixin ) | |
) | |
class CObjectMixinCSubMA new = Object new <: CSubMixinA new () () | |
class CSupMixinA new = Sup new <: A new () () | |
public class Sup = () ( | |
public superMethod = ( ^ #SupMethod ) | |
) | |
print: s = ( | |
Transcript show: s; cr. | |
) | |
public testMixins = ( | |
| EqToSupMixinA EqToCObjectMixinCSubMA | | |
(* Basics *) | |
print: 'testMixins'. print: ''. | |
print: Sup new superMethod. | |
print: A new mixinA. | |
print: 'mixins CSubMixinA: '. | |
print: CSupMixinA new superMethod. | |
print: CSupMixinA new mixinA. | |
print: 'mixins CObjectMixinCSubMA: '. | |
[ print: CObjectMixinCSubMA new superMethod.] on: Error do: [ print: 'superMethod failed' ]. | |
[ print: CObjectMixinCSubMA new mixinA.] on: Error do: [ print: 'mixinA failed' ]. | |
EqToSupMixinA:: A mixinApply: Sup. | |
print: 'mixins EqToSupMixinA: '. | |
print: EqToSupMixinA new superMethod. | |
print: EqToSupMixinA new mixinA. | |
EqToCObjectMixinCSubMA:: EqToSupMixinA mixinApply: Object. | |
[ print: EqToCObjectMixinCSubMA new superMethod.] on: Error do: [ print: 'superMethod failed' ]. | |
[ print: EqToCObjectMixinCSubMA new mixinA.] on: Error do: [ print: 'mixinA failed' ]. | |
) | |
) : ( | |
public testMixins: platform = ( | |
(* MyModule testMixins: platform *) | |
(platform: platform) testMixins | |
) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment