I think cljx is a great tool to paper over subtle differences in the
languages, that two compilers (like clj and cljs) accept, for use in
projects that would like to treat those compilers as black boxes (i.e.
almost all projects).
A new compiler (one that could compile itself to javascript, hence dubbed
cljs-in-cljs), however, is an opportunity to unify the accepted language,
such that it can target java byte code, javascript, variants thereof,
aswell as other platforms, without the need for an external preprocessor
like cljx. It's very well possible that such a unified implementation will
support feature expressions in the reader and that they will look like cljx
does and if we can get all the CAs, it might even use code from cljx.
I also think that just doing a straight port of cljs to feature expressions
is the wrong focus for now. Here are a couple of next steps that seem
logical to me:
- create clojure.tools.emitter.ecmascript from the clojurescript compiler
- update clojurescript to use clojure.tools.analyzer and
clojure.tools.emitter
- extend clojurescript to allow it to emit jvm byte code (from
clojure.tools.analyzer.{jvm,ecmascript})
- implement clojure.lang in clojure using swaths of cljs.core
Steps 3 requires a design, that is not present in either clojure or
clojurescript: an explicit model of the (compilation) target platform.
In clojure, this is currently hard coded to a tasty blend of #{load
whatever is on the classpath, emit ns/fns to jvm classes with asm, uniform
ABI at namespace level to allow additive loading}. For clojurescript,
add/substitute #{find macros in dual clj namespace, emit ns/fns to gclosure
packages}.
A compiler aiming to support multiple platforms should make it easy to
switch out or configure any of those.
For me this raises a pretty hard question: What should the concept of
"self-hosting" mean in a "hosted language" like clojure?
What do you think of this assessment?
kind regards
P.S. I've done some exploratory writing on this in the past:
http://dev.clojure.org/display/~bendlas/Design+for+compilation+units+in+ClojureScript
2014-05-18 21:50 GMT+02:00 Wes Brown <[email protected]>:
> So I've been taking a look at bringing my fork of cljs-in-cljs of to
> modern ClojureScript.
>
> After going through diff logs, the task of bringing kanaka's cljs-in-cljs
> fork up is pretty daunting, especially as one would have to maintain
> separate cljs and cli forks of the same analyzer and compiler duo; this
> explains his comment about compatible changes.
>
> Upon examining the Feature Expressions in Clojure situation, I was
> pondering whether cljs-in-cljs could instead be a modification of the
> Clojurescript code base that uses `clix` to shadow the differences?
>
> However, cljs-in-cljs does understand macros, and this isn't supported by
> `clix`.
>
> I'd be interested in feedbacks and thoughts -- it would be a useful
> exercise to cljx-ify the CLJS compiler and analyzer written in Clojure,
> using some of the changes and code that chouser and kanaka did.
>
> -Wes
>
> --
> Note that posts from new members are moderated - please be patient with
> your first post.
> ---
> You received this message because you are subscribed to the Google Groups
> "ClojureScript" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/clojurescript.
>
--
Note that posts from new members are moderated - please be patient with your
first post.
---
You received this message because you are subscribed to the Google Groups
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.