GithubHelp home page GithubHelp logo

kanaka / clojurescript Goto Github PK

View Code? Open in Web Editor NEW

This project forked from clojure/clojurescript

190.0 190.0 15.0 8.41 MB

Clojure to JS compiler (patched to allow compiling of compiler to ClojureScript)

Clojure 95.41% Shell 1.62% JavaScript 0.30% CSS 2.67%

clojurescript's People

Contributors

abedra avatar alandipert avatar arthuredelstein avatar bobby avatar brandonbloom avatar brentonashworth avatar bronsa avatar cemerick avatar chouser avatar devn avatar ericthorsen avatar ffailla avatar fogus avatar gozala avatar jessmartin avatar jonase avatar kanaka avatar lazerwalker avatar lynaghk avatar michalmarczyk avatar neotyk avatar netguy204 avatar ohpauleez avatar raph-amiard avatar redinger avatar richhickey avatar stuarthalloway avatar swannodette avatar thickey avatar wilkes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

clojurescript's Issues

Any updates to this?

Hi. This project looks neat, but looks like it has gone stagnant. How come development has stopped? Are there any new projects adressing the goals of this?

I am having trouble getting this to work.

I cloned it as is.

When run the first command: ../bin/cljsc ../src/cljs/webrepl.cljs > webrepl.js

I get: Error: Could not find or load main class clojure.main

Numeric keywords are broken

cljs.user=> :a
:a
cljs.user=> :2
ERR: TypeError: Cannot read property '0' of null
ERR:     at read_keyword (../cljs/reader.js:669:19)
...

Numeric keywords work in normal Clojure.

Uncaught Error: Undefined nameToPath for cljs.repl

I am new to closurescript, and this looks like a really cool project I would like to try to get running. I am particularly interested in the feature "You can have a ClojureScript REPL web app that runs locally in your browser (no server involved after loading the page)"

I cloned and followed the instructions to build the webrepl using steps below:

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

But when loading jsrepl.html I get the error "Uncaught Error: Undefined nameToPath for cljs.repl. (base.js:586)" I saw an older issue that was answered with a need to run the bootstrap script, which didn't help me. It seems like it is unclear what to use from the main clojurescript project, versus this patch to make it possible to run the repl native in the browser as in your demo.

It seems like I am missing a step for how to build all of the js files needed to run the webrepl (for example cljs/repl.js). I also tried manually building everything from the src directory using the various dependencies (starting from webrepl.js) but hit trouble when building the compiler.js with the included cljsc (which I am assuming is the future enhancement to compile itself, so what am I missing to get this working? Any advice would be greatly appreciated. I would be happy to update instructions if something has changed to get it working or if there is an assumption I am missing, etc. Any ideas where I went wrong with getting it running?

Hex number literals do not work

ClojureScript:

cljs.user=> 0x7e7
ERR: Error: Invalid number format [0x7e7] at line 0
ERR:     at reader_error__delegate (../cljs/reader.js:217:8)
...

Clojure:

user=> 0x7e7
2023

can't run stuff as described in README

I'm hoping to use this project to get some quick and dirty .js from .cljs in the context of a node project. I can't run any of the examples, e.g.

cd node
../bin/cljsc ../src/cljs/nodecljs.cljs > nodecljs.js

I get

Exception in thread "main" java.lang.NoClassDefFoundError: clojure/main
Caused by: java.lang.ClassNotFoundException: clojure.main
    at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)

There's no project.clj so lein deps can't be the answer. . . halp?

thanks.

Reader functions do not complain or error for arity

ClojureScript:

cljs.user=> (#(prn %) 1 2)
1
cljs.user=> (#(prn %1 %2) 1)
1 nil

Clojure:

user=> (#(prn %) 1 2)
ArityException Wrong number of args (2) passed to: user$eval2$fn  clojure.lang.AFn.throwArity (AFn.java:437)
user=> (#(prn %1 %2) 1)
ArityException Wrong number of args (1) passed to: user$eval8$fn  clojure.lang.AFn.throwArity (AFn.java:437)

Performance Enhancements

The cljs-in-cljs compile is slower than the regular ClojureScript compiler. I suspect there are some low hanging fruit that could be addressed easily to increase performance. Using profiling tools might reveal some areas to address.

Also, another area of interest would be to add support for output of asm.js code: http://asmjs.org/, http://asmjs.org/spec/latest/ This could potentially result in significant speedups especially for the persistent data structure implementations.

UI (jquery.console) annoyances (long lines, copy/paste)

The new UI from the Himera site uses jquery.console for the interactive part (and history). It looks nice but has some usage annoyances:

* long-lines can cause the cursor to disappear until you hit enter
* selecting text will immediately unselect making copy difficult
* using middle click (in X) to paste doesn't work (Ctrl-V paste does work)

Merge with upstream ClojureScript (especially for source map support)

The code base was forked from upstream ClojureScript several months ago and has not been merged with it since then.

One of the big features that is being added to upstream ClojureScript is source maps which would be a big benefit to cljs-in-cljs too.

Note that compiler.cljs and analyzer.cljs were copied from compile.clj and analyzer.clj so in addition to merging the *.clj versions, the changes will need to also be ported to the *.cljs versions of those files.

Problem building clojurescript: insufficient memory

I cannot build using ./script/compile; I get this:

# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (malloc) failed to allocate 1879048192 bytes for committing reserved memory.

Unfortunately, my computer has only 2GB of RAM. Any suggestions on how to get this to build?

division symbol breaks namespaces atom (currently removed)

Currently, the / symbol is removed from the namespaces snapshot during compile. If it's added back in like this:

--- a/src/clj/cljs/compiler.clj
+++ b/src/clj/cljs/compiler.clj
@@ -784,8 +784,7 @@

 (defn ns-snap [ns]
   (let [nss1 (dissoc (get @ana/namespaces ns) :requires-macros)
-        nss2 (read-string (pr-str (update-in nss1
-                                             [:defs] dissoc '/)))]
+        nss2 (read-string (pr-str nss1))]
     (apply str
       (emit (ana/analyze (ana/empty-env)
         (list 'swap! 'cljs.core/namespaces 'assoc (list 'quote ns) (list 'quote nss2)))))))

Then the compile throws an exception:

Exception in thread "main" java.lang.RuntimeException: Invalid token: cljs.core//
        at clojure.lang.Util.runtimeException(Util.java:170)
        at clojure.lang.LispReader.interpretToken(LispReader.java:321)

Also, it's likely that in core.cljs, the namespace and name functions will need to be fixed once the above works. For example, (namespace 'cljs.core//) gives "cljs.core/" because it is looking for the last /.

Namespaced keywords broken when referenced outside of the current namespace

For example, this works:

cljs.user=> (load-file "../test/cljs/cljs/quick.cljs")
cljs.user=> (in-ns 'cljs.test.quick-tests)
cljs.user=> (run-tests)

However, this does not:

cljs.user=> (load-file "../test/cljs/cljs/quick.cljs")
cljs.user=> (cljs.test.quick-tests/run-tests)
#<Error: Assert failed: (= *ns-sym* (symbol (namespace :G__1/foo)))> at line 1

Unicode symbols in strings are broken

ClojureScript (with debug enabled):

cljs.user=> "ü"
READ: "ü"
ANALYZED: "ü"
EMITTED: "\"\\u%04X\""
ERR: SyntaxError: Unexpected token ILLEGAL
...

Clojure:

user=> "ü"
"ü"

catch js/Object e causes `Can't qualify symbol in catch` error

I am trying to get core.async built with the compiler in the cljsc-in-cljsc tree. It looks like it takes exception to the js namespace for catch.

https://github.com/clojure/core.async/blob/master/src/main/clojure/cljs/core/async.cljs#L700

             (catch js/Object e
               (swap! dctr dec))))

The output given is:

Exception in thread "main" java.lang.AssertionError: Assert failed: Can't qualify symbol in catch
(not (namespace name))
    at cljs.analyzer$eval124$fn__126.invoke(analyzer.clj:284)
    at clojure.lang.MultiFn.invoke(MultiFn.java:241)
    at cljs.analyzer$analyze_seq.invoke(analyzer.clj:898)
    at cljs.analyzer$analyze.invoke(analyzer.clj:953)
    at cljs.analyzer$analyze_seq.invoke(analyzer.clj:900)

Looking at the analyzer.js code, it looks like we have a few special exceptions for namespace references to js -- I will see if I can get this to understand that it can ignore a namespace of 'js', but hints would be appreciated.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.