又来两种编译到 JS 的语言
Little Smallscript http://ympbyc.github.com/LittleSmallscript/
| Animal Snake sam |
Animal := Object subclass.
Animal method: [:name |
this at: #name put: name
] at: #init.
Animal method: [:metres |
window alert: ([@name](/user/name) + 'moved ' + metres + 'm.')
] at: #move.
Snake := Animal subclass.
Snake method: [
"'super' is not supported yet"
window alert: 'Slithering...'.
self move: 5
] at: #crawl.
sam := Snake new: 'Sammy the Python'.
sam crawl
six https://github.com/matthewrobb/six
// Arrow Function
[ 1, 2, 3 ].forEach( item => print(item) )
// Egal Operators
if(x isnt y && y is z) { }
// Classes
class Person {
constructor(name) {
this.name = name
}
greet() {
print("Hello, my name is " + this.name + ".")
}
}
// Quasi Literals / Template Strings
var me = new Person("Matthew")
print(`Hello, my name is ${me.name}.`)
List of languages that compile to JS https://github.com/jashkenas/coffee-script/wiki/List-of-languages-that-compile-to-JS
没完没了…