santoshrajan / lispyscript

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

clojure like keywords ? #5

Closed Gozala closed 12 years ago

Gozala commented 12 years ago

Can we get a clojure like keywords ? In clojurescript they used pretty neat hack for that: https://github.com/clojure/clojurescript/blob/master/src/cljs/cljs/core.cljs#L1452-1458

I would probably just used some other prefix like ":" or "@" to make it easy for JS and silpy to collaborate:

:keyword => "@keyword"

santoshrajan commented 12 years ago

Hi Gozala, do we really need this. We already have the "." notation to dereferece properties. Do you have any specific problem I can see?

Gozala commented 12 years ago

I think you misunderstand keywords. In clojure you don't need to define constants you just use them: :pending, :realized. In JS you either define them up front var PENDING = 0, REALIZED = 1 or just use strings like: `"pending", "realized". I was suggesting to take clojurescript's approach into a spin and prefix string with some character. That way it becomes just a convention of using strings for constants and prefxing them with some character to make sure they don't interfer with regular strings.

ghost commented 12 years ago

I would like to use defun, def, defmacro, lambda ... rather than function, var, ... because I think LispyScript is much more for lisp and/to js programmers than js programmers . Using def, defun seems to be more friendly.

santoshrajan commented 12 years ago

@analysis918 LispyScript tries to maintain the JavaScript semantics as far as possible.

However it is very easy to write a set of macros that will mimic any other Lisp dialect.