Skip to content


Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Comparing changes

Choose two branches to see what's changed or to start a new pull request. If you need to, you can also compare across forks.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also compare across forks.
base fork: clojure/clojurescript
base: master
head fork: kanaka/clojurescript
Checking mergeability… Don't worry, you can still create the pull request.
Commits on May 19, 2007
@kanaka kanaka io.cljs: implement classpath-like search for resources.*clojurescript-home* is set to the top of the Clojurescript
directory.*classpath-suffixes* represents the list of subdirectories
with *clojurescript-home* that are searched for resources.
@kanaka kanaka Merge remote branch 'arthuredelstein/web-edit' into cljs_in_cljs 85bec1e
@kanaka kanaka Fix codemirror submodule to work with github pages. 45b9c29
Commits on Nov 16, 2012
@kanaka kanaka Start of ClojureScript compiler in ClojureScript.
Compile like this:

rm -rf out/; bin/cljsc bs.cljs > bs.js && \
    bin/cljsc src/cljs/cljs/compiler.cljs > compiler.js && \
    bin/cljsc src/cljs/cljs/reader.cljs > reader.js

Then load comp.html. You will have a rep JavaScript function which
will read, eval and print:

    rep("(+ 1 1)");

CAVEAT: macros are not yet supported.
@kanaka kanaka Misc cleanup and add ns-snap. 9055ada
Commits on Nov 17, 2012
@kanaka kanaka Fix strings, numbers, false, regexp. 9e88716
@kanaka kanaka Add chouser's jsrepl modified to use the analyzer/compiler.
Build like this:

cd web
../bin/cljsc ../src/cljs/jsrepl.cljs > jsrepl.js
@kanaka kanaka Add build script for jsrepl.js. df22857
@kanaka kanaka Add some explanatory text to the jsrepl page. 3184a66
@kanaka kanaka Update README to explain the patched version. e58ebc2
Commits on Nov 29, 2012
@kanaka kanaka CLJS compiler and REPL working in Node.js
Compile and run the CLJS REPL:
    cd node
    ../bin/cljsc ../src/cljs/noderepl.cljs > noderepl.js
    cp ../src/cljs/goog.js out/
    ./run.js noderepl.js

Compile and run the the CLJS compiler wrapper:
    cd node
    ../bin/cljsc ../src/cljs/nodecljs.cljs > nodecljs.js
    cp ../src/cljs/goog.js out/
    ./run.js nodecljs.js hello.cljs

The :nodejs compilation target is currently broken. However, the
node/run.js bootstrap script enables compiled CLJS code to be
invoked that was not compiled with a :target.

Also, rename the jsrepl.cljs to webrepl.cljs to disambiguate with the
node.js equivalent (noderepl.js).
Commits on Dec 01, 2012
@kanaka kanaka Generate analyzer namespace snapshot while compiling.
This replaces the hardcoded bs.cljs file that only
provided cljs.core and cljs.user for the analyzer.

In order to load the snapshot, in Javascript (either in web/jsrepl.html
for web based or node/run.js) we set cljs.analyzer.namespaces to point
to cljs.namespaces (the snapshot built up during compilation).
Commits on Dec 08, 2012
@kanaka kanaka Add syntax quote/unquote to the reader. 0345cad
@kanaka kanaka Define *out* and *ns* to squelch compile warnings. fe0a35e
@kanaka kanaka Make node and web REPL prompt be *cljs-ns* 39d13a9
@kanaka kanaka Remove verbose reader debug. 8b24ba0
@kanaka kanaka Move namespaces to cljs.core and "refer" it from cljs.analyzer.
This removes the need for the custom Javascript code in the bootstrap
files and in the namespace snapshot code.
@kanaka kanaka Add macro support to JS built cljs analyzer/compiler.
This doesn't yet enable defining and immediate use of macros during
JVM based analyze/compile of cljs.

In other words, in the live Node.js and web REPL you can define new
macros and use them via the REPL. However, you can't define them yet
in a file, analyzer/compile it and then use them during or after
@kanaka kanaka Remove old multimethod version of emit-constant. f9d971e
@kanaka kanaka Remove old version of ns-snap from compiler.cljs f0e8369
@kanaka kanaka Move PushbackReader to core.cljs.
In normal Clojure this comes from java so it makes sense to put it in
core.cljs to make it more widely available (analyzer.cljs and
compiler.cljs will want this when they begin supporting whole files).
@kanaka kanaka Remove debug. ca7996f
@kanaka kanaka Remove require of bs from jsrepl.html. 0e23110
@kanaka kanaka Fix nodecljs.cljs wrapper to use correct push-back-reader location. fc472bf
@kanaka kanaka Update README and add runtime macro examples. bb7a168
@kanaka kanaka Correction to web and node.js REPL startup comments. 68081b5
Commits on Dec 12, 2012
@kanaka kanaka Properly munge symbols to JS names in get-expander.
Downside is that this creates an implicit dependency of cljs.analyzer
on cljs.compiler (munge).
Commits on Dec 14, 2012
@kanaka kanaka Debug and stack trace in noderepl and webrepl. fbd5901
@kanaka kanaka Fix syntax quote typos and syntax quote nil handling. 4255b31
@kanaka kanaka Activate and fix reader for ";" comments. 74ed2d3
@kanaka kanaka Add readers for anonymous functions and args. 75dc7ca
@kanaka kanaka Add destructure and Clojure core macros.
Add macros from Clojure core (specifically src/clj/clojure/core.clj).

In order to eval macros during analysis, we :use-macros to include
clj-defmacro which is then used to define precompile/analyzed macros
for later use at runtime.

Some minor changes have to be made to the macros to make them work
in ClojureScript via clj-defmacro:

- Use cljs.core/* symbols explicitly within syntax quoted sections of
  the macros.
- Convert java exceptions to Javascript exceptions.
- Stub out any code that tries to apply metadata to var/symbols.

Macros added:

- Add non destructuring stubs for let, loop.

- Add macros from Clojure (JVM) core:
    defn, when, when-not, cond, if-not, and, or, ->, ->>, if-let,
    when-let, doto, memfn, fn, when-first, comment, while, letfn.
@kanaka kanaka Add ClojureScript core macros.
This adds macros from ClojureScript (specifically
src/clj/cljs/core.clj) to the runtime.

- Add destructuring forms of let and loop

- Other macros added:
    satisfies?, binding, lazy-seq, delay, condp, case, try, assert,
    for, doseq, amap, areduce, dotimes, time, with-out-str
Commits on Dec 15, 2012
@kanaka kanaka Misc node and web REPL fixes/cleanup.
- Save last exception as noderepl/*e or webrepl/*e.
- Split ep function out of pep in webrepl to match noderepl.
- Don't throw EOF error in noderepl when line is blank.
@kanaka kanaka Update README. c4d36bf
Commits on Dec 16, 2012
@kanaka kanaka Remove REPL note about missing predefined macros. b197f9f
Commits on Dec 24, 2012
@kanaka kanaka Make symbols first class objects rather than prefixed strings.
Specifically this allows symbols to have metadata. This is widely used
for communicating metadata among the type/protocol macros and the
analyzer. The downside is that symbol map keys can be slower because
in Javascript objects cannot be used as attribute keys. This means
that a slower path is used for objects that contain symbols as keys.
@kanaka kanaka Cleanup various exceptions. 913c689
@kanaka kanaka Synchronize spacing/ordering with Clojure/ClojureScript core.* e9a9405
@kanaka kanaka Add array macros and add commented out '.. and 'js-obj
This brings core.cljs more in sync with core from
Clojure/ClojureScript core.clj
@kanaka kanaka Add type/protocol macros from ClojureScript core.clj
Add these macros and supporting functions/macros.

reify, extend-type, deftype, defrecord, defprotocol
@kanaka kanaka Add multimethod macros (defmulti, defmethod). 3654132
@kanaka kanaka Update TODOs and bugs in README. 9140c7c
Commits on Dec 27, 2012
@kanaka kanaka Fix iEquiv of namespaced symbols. ba2fe80
@kanaka kanaka Fix protocol-prefix regex to match multiple delimiters. ec757d8
@kanaka kanaka Allow ns multiple times for same namespace.
The ns "macro" normally generates goog.provide for the namespace,
however, goog.provide will error if the name already exists. We set
the *emittted-provides* to an empty var even if we are compiling
outside a file (i.e. REPL) so that multiple invocation of ns will not
cause an error. This mirrors Clojure behavior.
@kanaka kanaka Add in-ns, fix munging of names in create-ns
Also, move *ns* and create-ns to cljs.core.
@kanaka kanaka Web and node REPL namespace related fixups.
- Better bootstrap of initial cljs.user namespace that allows
  switching back in.
- Redefine analyzer environment for each new form before evaluation so
  that the current namespace is set correctly based on *cljs-ns*.
- Update current namespace in front of the prompt textarea.
- Remove some old debug functions from jsrepl.html
@kanaka kanaka Add extend-protocol. 29ecdba
Commits on Dec 28, 2012
@kanaka kanaka Implement ".." macro with analyzer/compiler fixes.
- In compiler/munge, replace ".." with "_DOTDOT_".
- In analyzer/resolve*var, do not treat ".." as ".abc" form.
@kanaka kanaka Update README 1d7b6de
@kanaka kanaka Fix webrepl typo. 31d296d
Commits on Jan 01, 2013
@kanaka kanaka Refactor namespaces as normal Clojure datastructure.
In Clojure, a namespace is a mutable Java object that changes as the
namespace is modified (new vars are added). For example, *ns* will
hash to the same thing before and after def'ing a new var even though
*ns* now contains the new var. In ClojureScript, all namespaces are
contained ina single atom cljs.core/namespaces that are indexed by
namespace symbol.

Instead of using a special global *ns* symbol that holds the current
namespace as a mutable Java object, use *ns-sym* as the symbol name of
the current namespace and whenever the namespace is needed, deref the
namespaces atom to look it up.

Remove ns related functions from analyzer and add some ns functions to
core based on those in Clojure core but using cljs.core/namespaces:
create-ns, find-ns, resolve, resolve-ns.
Commits on Jan 05, 2013
@kanaka kanaka Add declare, defonce and stub defn-
- defn- marks the def :private but there is nothing that will stop
  non-local lookups as yet.
@kanaka kanaka Fix -prototype call in extend-type. 9a420c1
@kanaka kanaka Add load-file, forms-seq, compile-forms*.
load-file is similar to the Clojure version but returns a map of
compile info rather than the result of the final form in the file.
load-file* returns the same map but includes :emit-str (the emitted
Javascript) and :output (any output printed during load, rather than
printing it directly).
@kanaka kanaka Fix typo in comment. daf59f0
@kanaka kanaka Fix nodecljs.cljs to not rely on js/env. a3cce03
@kanaka kanaka Add quick.cljs test to cover basics quickly.
At the REPL load and run like this:

> (load-file "../test/cljs/cljs/quick.cljs")
> (runt-tests)
Commits on Jan 06, 2013
@Gozala Gozala Fix reader to read regexp properly. d963f82
@Gozala Gozala Remove repeated definition of emit-str function b7619ff
@Gozala Gozala Move regexp escaping from reader to compiler. 45a222d
@kanaka kanaka Merge pull request #1 from Gozala/selfhosted/regexp
Fix for regexps containing / character
@Gozala Gozala Configure integration tests. 4308fb2
@Gozala Gozala Print read & analysed forms in debug mode. 8a719e4
@kanaka kanaka Merge pull request #2 from Gozala/selfhosted/travis
Configure integration tests.
Commits on Jan 07, 2013
@Gozala Gozala `re-seq` has tail only if `past-match` is non empty string. cded82c
@kanaka kanaka Merge pull request #3 from Gozala/selfhosted/debug-print
Print read & analysed forms in debug mode.
@Gozala Gozala Fix regression introduced by #1 c2805bc
@kanaka kanaka Merge pull request #4 from Gozala/selfhosted/re-seq
Fix for (re-seq #"^$" "")
@kanaka kanaka Update README, REPL debug, quick.cljs tests.
- Update bugs and TODOs in README.
- Separately print the read, analyzed and emitted code so that if it
  breaks after one step the intermediate results are still output.
- Add a regex test for fixed cases. Remove a couple of redundant tests
  (this focus is quick after all). Add a case for the time macro.
Commits on Jan 08, 2013
@kanaka kanaka Revert "Move PushbackReader to core.cljs."
This reverts commit eaa8eeb.

Having it in core.cljs doesn't really clean up dependencies and there
are tighter relationships between the push-back-reader and the other
read functions in reader.cljs.


@kanaka kanaka Fix typo in quick.cljs test. 004c0d3
@kanaka kanaka Add File/file ops to io.cljs. Restore analyzer/compiler file routines.
- Add File type, file I/O, path operations to src/cljs/cljs/io.cljs.
- Restore analyze-file in analyzer.cljs
- Restore compile-file, compile-root and other file related functions
  to compiler.cljs.
- Copy ns-snap (namespace snapshot) from src/clj/cljs/compiler.cljs to
@Gozala Gozala Unescape regerxp source before printing it. 644ea39
@kanaka kanaka Merge pull request #5 from Gozala/selfhosted/print-regexp
Fix: regexes with forward slashes are printed with extra escaping
Commits on Jan 14, 2013
@kanaka kanaka Web REPL clean. Split out CSS. Fix multiline entry. 2caa19d
@kanaka kanaka Merge remote branch 'kanaka/cljs_in_cljs' into cljs_in_cljs 0317c18
@arthuredelstein arthuredelstein use the same font for input and output code f4642f3
@kanaka kanaka Merge pull request #11 from arthuredelstein/cljs_in_cljs
use the same font for input and output code
Commits on Jan 15, 2013
@arthuredelstein arthuredelstein Add support for *1,*2,*3 a5a849f
Commits on Jan 16, 2013
@kanaka kanaka Cleanup web and node REPL/compiler bootstrap code.
Move the pre-compiled bootstrap code from JavaScript to the .cljs
@kanaka kanaka Merge pull request #13 from arthuredelstein/a5a849fef5bcfcc0a79d0d1e1…

Support in web REPL for *1, *2, *3
@kanaka kanaka Add web REPL UI based on Himera.
- Import base HTML, stylesheets and images from Himera
  ( Also, import synonym.html
  sibling file that has JavaScript to ClojureScript translations.
- Add src/cljs/webrepl2.cljs that implements the new REPL.

The new REPL can be built like this:

    cd web
    ../bin/cljsc ../src/cljs/webrepl2.cljs > webrepl2.js

Then open web/repl.html. The new REPL page has a much better design
and style with the reference/links from the Himera front page. The
REPL window is based on jquery.console and has history (up arrow)
Commits on Jan 17, 2013
@fogus fogus Minor modifications.
 * Made header link and tweaked style to support that
 * Added attribution
@kanaka kanaka Merge pull request #14 from fogus/cljs_in_cljs
Minor modifications.
@kanaka kanaka Fix division symbol.
- In ns-snap munge the cljs.core// symbol before and after read-string
  to avoid the Clojure-side exception.
- For cljs.core/name and cljs.core/namespace, correctly handle / and
  cljs.core//. This brings these functions in sync with
@kanaka kanaka Misc README updates. be624b7
Commits on Jan 18, 2013
@Gozala Gozala Fix keyword reader. eb17897
@Gozala Gozala Fix keyword function to match clojure's behaviour. 32ba9d9
@kanaka kanaka Merge pull request #16 from Gozala/bug/numeric-keywords
Fix for numeric keywords #7
Commits on Jan 19, 2013
@Gozala Gozala Write keyword tests. a99adce
@kanaka kanaka Merge pull request #17 from Gozala/bug/numeric-keywords
Write keyword tests for #16 (numeric keywords)
Commits on Jan 20, 2013
@Gozala Gozala Fix reader bug for a hex literals #9 e51c76d
@Gozala Gozala Fix compiler support for unicode strings #10 e666270
Commits on Jan 21, 2013
@kanaka kanaka Merge pull request #19 from Gozala/bug/hex
Fix reader bug for a hex literals #9
@kanaka kanaka Merge pull request #21 from Gozala/bug/unicode
Fix compiler support for unicode strings #10
Commits on Jan 22, 2013
@arthuredelstein arthuredelstein swap in jq-console; swap out jquery.console 47007ff
@arthuredelstein arthuredelstein swap in jq-console; swap out jquery.console 6de1f93
@arthuredelstein arthuredelstein update jq-console 4b3bb87
@arthuredelstein arthuredelstein use minimized jqconsole 9690a83
@arthuredelstein arthuredelstein primitive but tolerable indentation 497aaa2
@arthuredelstein arthuredelstein improve indentation matters by varying continuation label 1e053b4
@arthuredelstein arthuredelstein remove unneeded requires 9541dc5
Commits on Jan 24, 2013
@arthuredelstein arthuredelstein go back to using minimized jqconsole 4b80a1b
@arthuredelstein arthuredelstein remove obsolete function b27aa6b
@kanaka kanaka Import original closure.clj to closure.cljs ce4889f
@kanaka kanaka add .isDirectory and .listFiles methods to File type. b661eb3
Commits on Jan 25, 2013
@kanaka kanaka First pass at require function. 041cbea
@kanaka kanaka Fix cljs version of ns-snap. 6537c1f
@kanaka kanaka cljs.compiler: better already provided detection.
Trying to provide multiple times should just be a no-op.
@kanaka kanaka Better error feedback from eval in compile-forms*. a7dc121
@kanaka kanaka Use *ns-sym* in REL code instead of analyzer's *cljs-ns*. d98a93a
@kanaka kanaka cljs.analyzer: restore locals/macro lookup in get-expander. a1ab87a
@kanaka kanaka Merge remote branch 'arthuredelstein/jqconsole' into cljs_in_cljs 37c26d2
@kanaka kanaka Fix web REPL lookup of *ns-sym*. ea928da
@kanaka kanaka First pass at porting closure.clj and cljsc.clj.
Build like this:
    ../bin/cljsc ../src/cljs/cljsc.cljs > cljsc.js && cp ../src/cljs/goog.js out

Run like this:
    ./run.js cljsc.js hello.cljs > hello.js

It will attempt to compile using out2 as the output directory
and will blow up trying to compile core.cljs.
@kanaka kanaka Better long line handling in web REPL (Himera version). 6876d9c
Commits on Jan 26, 2013
@amasad amasad Update jqconsole to enable middle click paste on linux 60b73e3
Commits on Jan 28, 2013
@kanaka kanaka Merge pull request #24 from amasad/cljs_in_cljs
Update jqconsole to enable middle click paste on linux
Commits on Feb 11, 2013
@kanaka kanaka Combine macro setting with rest of "var" data.
- Add deep-merge to core.cljs to enable merging of the macro settings
  into the namespaces/vars.
- Also, in get-expander, lookup "vars" in uses-macros and
  require-macros structure.
@Bronsa Bronsa reader: use blind's Reader types implementation 078c1b8
@Bronsa Bronsa reader: use line/column info where possible d80c97d
@kanaka kanaka Fixes to blind's Reader implementation.
- Fixes: add missing newline? function, use satisfies? instead of
  instance?, fix incorrect set-pos variable name in read-char
- Also, use the new reader convenience functions in compiler, analyzer
  and closure.

TODO: use of indexing-push-back-reader in compiler.cljs forms-seq
causes errors processing metadata when using load-file so for now it
is using string-push-back-reader.
Commits on Feb 12, 2013
@kanaka kanaka Active line/column for reader errors during forms-seq.
Define new emit-constant for ObjMap protocol which handles some forms
of metadata during read.
Commits on Feb 13, 2013
@kanaka kanaka compile-forms*: only eval if requested, line nums on eval errors.
Add two entry points to compile-forms*: compile-forms and
compile-and-eval-forms. The latter is used by load-file (and
:use-macros, :require-macros) to eval while loading the file (full
compilation and evaluation). The former is used by compile-file* to
compile but not evaluate the forms when doing ahead of time
compilation (i.e. the way that ClojureScript does compilation right
now via closure.clj).
@kanaka kanaka run.js: check if there is a *main-cli-fn* before calling. bde3d12
@kanaka kanaka Add output "streams" and use them in the various REPLs.
- redefine *out* and *err* as functions that do output rather than
  raw I/O streams.
- also add *rtn* for return value output.
Commits on Feb 16, 2013
@kanaka kanaka Add reader support for octal/unicode constants. ff0ceb7
@kanaka kanaka Partial self-hosting (all except core.cljs)
With these changes, src/cljs/cljsc.cljs (which invokes build in
closure.cljs) can compile the whole compiler except for core.cljs. The
target of the new compiler is currently set to out2 to not collide
with the compiler that was compiled by the original ClojureScript.

Here is the working test process:

    - Compile the compiler
        cd node
        rm -rf out
        cp ../src/cljs/goog.js out/
        time ../bin/cljsc ../src/cljs/cljsc.cljs > cljsc.js

    - Setup the new output directory with already compiled core.cljs:
        rm -r out2/
        mkdir -p out2/cljs
        cp out/cljs/core.js out2/cljs
        cp ../src/cljs/goog.js out2

    - Use the compiled compiler to compile the REPL:
        time ./run.js cljsc.js ../src/cljs/noderepl.cljs > noderepl.js

    - Run the new REPL:
        ./run2.js noderepl.js


- Copy in closure lib files into (originally these came from a jar of
  the closure library).
- Pre-populate the emitted-provides with cljs.core during
  closre.cljs::build so that goog.provide doesn't complain since
  cljs.core is already defined in the compiler that is running.
- Only load-file in require if it is not already defined in
- Add a new launcher (run2.js) that uses the out2/ sub-directory
  rather than out/.
Commits on Feb 17, 2013
@kanaka kanaka Factor out common REPL code to cljs/cljs/repl.cljs
Also get nodecljs.cljs working using repl.cljs and add example
shebang.cljs which can be executed directly.
Commits on Feb 21, 2013
@kanaka kanaka Merge pull request #28 from arthuredelstein/web-edit
REPL behavioral features (*e, more err line numbers)
@arthuredelstein arthuredelstein Features added:
1. *e returns the most recently thrown error in the REPL.
2. If multiple forms are submitted at the REPL, then forms are evaluated in order until
   an error occurs. If an error occurs, the error is printed. Otherwise the value of the
   last form is printed and assigned to *1.
3. Line numbers are shown for all printed errors.
@arthuredelstein arthuredelstein use cljs.core/*e instead of clojure.core/*e 6357ead
@arthuredelstein arthuredelstein factor out jqconsole code into webconsole.cljs aea80af
@arthuredelstein arthuredelstein File editor for web repl:
1. Create a CodeMirror-based file editor (in webedit.cljs)
2. Create webrepl3.cljs and repl3.html, which use the file editor
3. builds the console-only version of; builds the version including both console and file editor.

The file editor's contents can be evaluated in the REPL by pressing
Ctrl/Cmd+E, and the editor itself can be shown and hidden by pressing
the Show/Hide file editor link.
Commits on Oct 30, 2013
@lazerwalker lazerwalker Update bootstrap script to Clojure 1.5.1
Also, a more recent version of Google Closure when not using --closure-library-head
@lazerwalker lazerwalker Remove (broken) dependency on goog.string.format 112329d
@lazerwalker lazerwalker Replace clojure core.str with cljs.core.str 3878e43
Commits on Oct 31, 2013
@lazerwalker lazerwalker Update README d03760f
Commits on Nov 19, 2013
@kanaka kanaka Merge pull request #38 from lazerwalker/master
Improve documentation and update broken setup
Commits on Apr 22, 2014
@wbrown wbrown Application of patch a4f7a89 from clojurescript master to fix `com.go…
…ogle.javascript.jscomp.JSSourceFile` depreciation issues.
@wbrown wbrown Fix closure compiler download path.. b67eb1c
@kanaka kanaka Merge pull request #40 from wbrown/cljs_in_cljs
`` depreciation issues