santoshrajan / lispyscript

A javascript with Lispy syntax and macros
MIT License
572 stars 57 forks source link

Feature request: quote syntax. #50

Open ikeji opened 9 years ago

ikeji commented 9 years ago

Hi Can you add quote syntax to expand s-expression to data?

Now I'm trying to use lispyscript with gulp. Gulp have api like this.

    gulp.task("taskname", function() { doSometing(); })

I'd like to use this api like this using macro.

    (deftask taskname
        (doSomething))

But I can't found the way to convert taskname to "taskname" in macro.

I propose more general solution that implement quote.

I want to use quote syntax like this:

   (quote taskname)

Expand to js like

   "taskname"

Then I can define macro like:

(macro (name rest...)
  (gulp.task (quote ~name) (function () ~rest...)))
riatzukiza commented 8 years ago

I agree that this would be a useful feature. you could also do macros like this, if you also had some kind of itterator syntax for the homoiconic values

(macro constructor (rest...)
(function ((#args-loop rest... x (quote ~x)))
(#args-loop rest... x (set (quote ~x) this ~x)))

Though this repository doesn't seem to be too active any more, may never happen if us the users don't do it our selves.