#! shebang

syntaxsince v0.0-1853 in clojureEdit

ClojureScript allows shebang lines simply by making #! equivalent to ; comment.

  • #!/usr/bin/env planck - use Planck to execute this file

Examples:

#!/bin/cljs
;; waits for another form since #!/bin/cljs was ignored.

123 #! this is ignored
;;=> 123

Reader code @ tools.reader:src/main/clojure/clojure/tools/reader/impl/commons.clj
(defn read-comment
  [rdr & _]
  (skip-line rdr))

Reader table @ tools.reader:src/main/clojure/clojure/tools/reader.clj
(defn- dispatch-macros [ch]
  (case ch
    \^ read-meta                ;deprecated
    \' (wrapping-reader 'var)
    \( read-fn
    \= read-eval
    \{ read-set
    \< (throwing-reader "Unreadable form")
    \" read-regex
    \! read-comment
    \_ read-discard
    \? read-cond
    \: read-namespaced-map
    \# read-symbolic-value
    nil))