Lisp representation for the JS dot operator

I once took a poll on Arc Forum about the most ergonomic lispy
representations for JavaScript dot notation. Recently I’ve been taken
by all the options Clojure provides for its Java Interop and am inspired to consider similar possibilities for LavaScript:

  1. a.b         a.b
  2. (. a b)     a.b
  3. (a.b)       a.b()
  4. (.b a)      a.b()

Ways to get document.getElementById(“foo”).value:

  1. (.value (.getElementById document ”foo”)
  2. (.value (document.getElementById ”foo”)
  3. (.value (. document getElementById ”foo”))
  4. (. (. document getElementById ”foo”) value)
  5. (.. document (getElementById ”foo”) value)

About Evan

Works on a sight reading practice tool for musicians and music teachers, and loves making Try Arc better in his spare time.

, , , ,

No comments yet.

Leave a Reply