Skip to content

shaunxcode/AmberMixins

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 

Repository files navigation

Mixins

##what simple approach to mixins for smalltalk (specifically amber). Based on the article by Terry Montlick: Implementing mixins in Smalltalk.

##Usage Any class which you want to utilize mixins must respond to mixins which returns a Collection containing the other class instances which should be mixed in.

##Example

Object subclass: #Example
        instanceVariableNames: 'mixins'
        
initialize
        "initialize mixins collection"
        mixins := Dictionary new.
        mixins at: #Events put: new Events.

mixins
        ^mixins


Imagining for a moment that we have an Events class which provides on:do and trigger: messages.

| exampleInstance |
exampleInstance := new Example.
exampleInstance on: #someEvent do: [console log: 'called someEvent'].
exampleInstance trigger: #someEvent.

About

mixin system for smalltalk, specifically targetting amberjs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors