Skip to content

Instantly share code, notes, and snippets.

@FireyFly
Forked from robotlolita/object.js
Created October 16, 2011 20:20
Show Gist options
  • Save FireyFly/1291370 to your computer and use it in GitHub Desktop.
Save FireyFly/1291370 to your computer and use it in GitHub Desktop.
var Talkable = {
talk: function(){
return this.name + ': ' + this.speech()
}
}
var Animal = Object |> {
trait Talkable,
name: 'Animal',
get speech() '...'
}
var Cat = Animal |> {
name: 'Cat',
get speech() 'meow'
}
var nyan = Cat |> { name: 'Nyan nyan nyan' }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment