lantiga / ki

lisp + mori, sweet.js
ki-lang.org
MIT License
478 stars 28 forks source link

using ki in coffeescript #30

Closed noncom closed 8 years ago

noncom commented 8 years ago

Is it possible to make Ki work with CoffeeScript? Judging by this article https://coffeescript-cookbook.github.io/chapters/syntax/embedding_javascript it should be as easy as putting a pair of backticks around the generated JS (supposing that the first pass is for the Ki compiler and the next pass is for the CS compiler to get the resulting JS). Is this truly so? Can this somehow be implemented?

lantiga commented 8 years ago

Unfortunately it's not working: the CoffeeScript compiler trips over the ki macro, and in turn sweet.js (which expands the ki macro) trips over CoffeeScript syntax. Try for instance with a file like:

`function greet(name) {
  ki (def a 1)
  return "Hello "+name;
}`

# Back to CoffeeScript
greet "Coffee"
# => "Hello Coffee"

This is really in the scope of either the CS compiler or sweet.js.