On Wed, Jan 27, 2016 at 1:28 PM, Timothy Baldridge <tbaldri...@gmail.com>
wrote:

> It seems to me that there has to be a simpler approach to what you are
> trying to accomplish. To that end, what is your end goal, and why is 
> "splitting
> the cljs into a .cljs file is not an option"?
>

The end goal is a unified language (Clojure/script) for writing Web
Component apps, specifically defining and using Polymer components.  As a
simple example of what I mean by that, consider the symmetry between (ns
foo (:require ...)) in a Clojure file, and <head><link rel="import" ...>
...</head> in an HTML file.  They effectively do the same job: locate,
load, and register some resources in the local env.  So if I want to use
Polymer paper elements, instead of writing a <link> element, I write:

  (h/require '[polymer.paper :as paper :refer [button card]])

And to use a js or css resource, I write a "(h/import ...)" that looks just
like a Clojure import declaration.  Of course there's some configuration
code I'm not showing, but it's pretty straightforward and can be used
across projects.

When it comes to defining components, Polymer is pretty complex.  But if
you stare at it long enough various Deep and Beautiful Symmetries will
begin to emerge - components are like types, as are behaviors; event suites
and listeners are effectively protocols (or co-protocols), etc.  So in the
end we hide all the HTML+JS complexity, and code to define a Polymer
component looks pretty much exactly like the code for an ordinary deftype.
That includes inline method definitions - which in this case are callback
or listener definitions.  I guess you could argue that the language for fn
definitions it is not really clojurescript, it's more like a clojure
extension or  DSL if you prefer that just looks like clojurescript.  When
evaluated it generates clojurescript.

Or another way of looking at it:  we replace HTML+JS with Clojure +
Clojurescript.  Still not quite a single unified language, but pretty
darned close.

So I guess the simple answer to why the clojurescript cannot be split out
is because I want to support inline definitions.

-Gregg



Gregg

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to