Skip to content

Instantly share code, notes, and snippets.

@5v3n
Created November 6, 2010 10:11
Show Gist options
  • Save 5v3n/665321 to your computer and use it in GitHub Desktop.
Save 5v3n/665321 to your computer and use it in GitHub Desktop.
sys = require 'sys'
class MyMath
square: (x) ->
x * x
cube: (x) ->
this.square(x) * x
#let's get something rolling:
myMath = new MyMath
x = 3
#mind the nice string processing:
sys.puts "square(#{x}) = #{myMath.square(x)}"
sys.puts "cube(#{x}) = #{myMath.cube(x)}"
#what's next - dynamic dispatching ;-)?
@5v3n
Copy link
Author

5v3n commented Nov 6, 2010

Generated the JavaScript code in gist 665322 using this CoffeeScript. Nice!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment