Skip to content

Instantly share code, notes, and snippets.

@smarr
Created December 10, 2017 22:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smarr/cb8529892d6e4d72b43efd94a55d515e to your computer and use it in GitHub Desktop.
Save smarr/cb8529892d6e4d72b43efd94a55d515e to your computer and use it in GitHub Desktop.
Mixin Issue Newspeak
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