Skip to content

Instantly share code, notes, and snippets.

@deathbeam
Last active May 11, 2016 14:51
Show Gist options
  • Save deathbeam/9b1a5d7165535165b037d2e6973ac4ff to your computer and use it in GitHub Desktop.
Save deathbeam/9b1a5d7165535165b037d2e6973ac4ff to your computer and use it in GitHub Desktop.
Spoon compiler test
#!/usr/bin/env coffee
# Spoon code:
greet = name -> trace "Hello #{name}, how are you?"
greet "Person"
# Compiler result (fully working Haxe code):
#
# class Greet {
# static public function main() {
# var greet = function (name) return trace('Hello ' + name + ', how are you?');
# greet('Person');
# }
# }
@Justinfront
Copy link

Justinfront commented May 10, 2016

In AS3 I might do greet like that but in Haxe I would use string interpolation.
var greet = function (name) return trace('Hello $name, how are you?');
see: http://try.haxe.org/#B5AB4 you also don't need the return keyword in this example.
http://haxe.org/manual/lf-string-interpolation.html
Not sure that it's an extensive enough example for your point to be validated, think it would be more useful to post maybe some 3d drawing or some xml parsing or something, best Justin

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