On Jan 11, 4:20 pm, Ram  Krishnan <kriyat...@gmail.com> wrote:
> > * Mozilla's JS 1.7 supports a let statement[1] with lexical scoping,
> > ...
> That's an interesting idea, although I'm not too keen on specializing
> for any one browser. The other problem is I don't see any reasonable
> way of providing the alternates from a web server without some form of
> user-agent sniffing.

You're right, any potential benefits could only be reaped under very
specific circumstances. Making the codebase more complex to optimize
for these limited cases doesn't make sense.

I've taken a deeper look yesterday and am positively surprised how
much easier to understand the implementation is than expected. Very
cool. A few design decisions caught my eye though, and could IMO be
improved:

Using a ref won't actually improve your concurrency experience with
*macros* (provided I understand your code correctly). Since the
parsing and emitting is written in an inherently linear style, there
will only ever be one transaction altering *macros*. More problematic
though is the case where two threads happen to concurrently translate
completely independent (js ...) expressions. Since *macros* is global,
both threads would share the same macro definitions even if totally
different code bases are being translated! This problem could be
mitigated by using thread local bindings for *macros*. Refs or atoms
are not neccessary in this case; even plain old (set!) would do.

Another thing that strikes me as a potentially bad idea is the
reliance on imperative behaviour to generate output, i.e. "emitting"
or "printing" generated code to a stream instead of returning the
pieces in a functional way and combining them afterwards. This
imperative style could hamper your code's composability in the
future. ... What do others think?

With all that said -- it's actually quite pleasant to work with right
now. If you're interested in patches, I've done some small
refactorings to remove duplicate code, added basic docstring support
and other small fixes. Please see my fork at:

https://github.com/danwerner/clojurejs

Daniel

-- 
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

Reply via email to