Created
November 6, 2010 10:11
-
-
Save 5v3n/665321 to your computer and use it in GitHub Desktop.
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
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 ;-)? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Generated the JavaScript code in gist 665322 using this CoffeeScript. Nice!