Created
October 15, 2014 12:17
-
-
Save glaforge/f7ddece9d4e0ff2afe82 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| @Grab('com.netopyr.coffee4java:coffee4java:1.0.0') | |
| import javax.script.ScriptEngineManager | |
| def coffeescript = new ScriptEngineManager().getEngineByName('coffeescript').factory.scriptEngine | |
| assert coffeescript.eval('''\ | |
| square = (x) -> x * x | |
| return square 3''') == 9 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I have this silly idea few day ago that it would be fantastic if you can write some code in CoffeeScript instead of Groovy because as soon as you start to use CoffeeScript more you find a plethora of unnecessary brackets everywhere. I'm totally lame in writing anything non-trivial such as class loaders or or compilers but the idea is
src/main/coffeeinstead ofsrc/main/groovy)The point is to be able to call Groovy code from CoffeeScript and on the other hand to be able to declare classes in CoffeeScript which can be called later from Groovy.
And idea how to achieve with small effort e.g. global AST executed in very early phase?