lantiga / ki

lisp + mori, sweet.js

Home Page:ki-lang.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

using ki in coffeescript

noncom opened this issue · comments

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?

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.