logoalt Hacker News

hnlmorg • today at 4:33 PM • 3 replies • view on HN

WAT is just Sexpr isn’t it?

There’s a lot of people, myself included, who quite like s-expressions. And it’s not all that surprising that WAT is LISPy given JavaScript was originally intended to be a LISP too.


Replies

masklinn • today at 4:52 PM

It's just sexpr but it's a rough sexpr since it's an exact translation of the bytecode:

    (func $add (export "add") (param $x i32) (param $y i32) (result i32)
      (i32.add (local.get $x) (local.get $y)))
In clojure using native annotations, that would be along the lines of

    (defn add ^int [^int x ^int y]
      (+ x y))
gavmor • today at 8:43 PM

Yeah, "user-friendly" here just means non-homoiconic, Algol-style.

boxed • today at 5:10 PM

> given JavaScript was originally intended to be a LISP too.

Isn't that basically just apocryphal handwaving? Javascript doesn't look like a lisp in any way, not syntactically obviously, but not behaviorally either. To say that he aimed for a lisp with C ish syntax either means he failed extremely bad, or that he thought lisp was shit.

➕ show 1 reply