Re: ClojureScript Compile errors

2011-08-29 Thread David Nolen
On Wed, Aug 10, 2011 at 7:39 AM, Rich Hickey richhic...@gmail.com wrote:

 :use … :only doesn't have the problems of full :use.

 Enhancement ticket and patch for :use … :only welcome. Note it must support
 :use … :only only, i.e. :only is required.

 Rich


http://dev.clojure.org/jira/browse/CLJS-65. Hopefully this is an ok
approach. Also couldn't find any tests related to namespace declaration
parsing so I didn't add any.

David

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

Re: ClojureScript Compile errors

2011-08-10 Thread Rich Hickey
:use … :only doesn't have the problems of full :use.

Enhancement ticket and patch for :use … :only welcome. Note it must support 
:use … :only only, i.e. :only is required.

Rich

On Aug 9, 2011, at 10:01 AM, David Nolen wrote:

 On Sat, Aug 6, 2011 at 5:30 PM, Rich Hickey richhic...@gmail.com wrote:
 In Clojure, namespaces are different from the host's packages, in 
 ClojureScript they are the same (insofar as they match the Google Closure 
 approach).
 
 Makes sense.
  
 Why all the attention to :use - I thought everyone agreed using it is a bad 
 idea?
 
 I like pairing :use with :only especially between files that belong to the 
 same library.
  
 In any case, ClojureScript is a subset and right now that subset doesn't 
 include :use. People who want it will have to explain why they think it's 
 important. Its cost is that namespaces have to be enumerable, which poses 
 challenges for code (re)loading and modularity for Clojure. The only benefit 
 I see is that you can avoid a (minimum 2 character) prefix.
 
 Rich
 
 Yeah I can see the cost/benefit here. I haven't had time to dig into 
 ClojureScript for anything substantial so I don't know if this feels 
 problematic in practice. I suspect in the end it won't matter much and it 
 does encourage good style.
 
 David
 
 -- 
 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 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


Re: ClojureScript Compile errors

2011-08-09 Thread David Nolen
On Sat, Aug 6, 2011 at 5:30 PM, Rich Hickey richhic...@gmail.com wrote:

 In Clojure, namespaces are different from the host's packages, in
 ClojureScript they are the same (insofar as they match the Google Closure
 approach).


Makes sense.


 Why all the attention to :use - I thought everyone agreed using it is a bad
 idea?


I like pairing :use with :only especially between files that belong to the
same library.


 In any case, ClojureScript is a subset and right now that subset doesn't
 include :use. People who want it will have to explain why they think it's
 important. Its cost is that namespaces have to be enumerable, which poses
 challenges for code (re)loading and modularity for Clojure. The only benefit
 I see is that you can avoid a (minimum 2 character) prefix.

 Rich


Yeah I can see the cost/benefit here. I haven't had time to dig into
ClojureScript for anything substantial so I don't know if this feels
problematic in practice. I suspect in the end it won't matter much and it
does encourage good style.

David

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

Re: ClojureScript Compile errors

2011-08-09 Thread Chas Emerick
On Aug 9, 2011, at 10:01 AM, David Nolen wrote:

 On Sat, Aug 6, 2011 at 5:30 PM, Rich Hickey richhic...@gmail.com wrote:
 Why all the attention to :use - I thought everyone agreed using it is a bad 
 idea?
 
 I like pairing :use with :only especially between files that belong to the 
 same library.

Agreed.  Beyond that, I have some utility namespaces that provide functions so 
fundamental and commonly-used that even a 2-character prefix would be a painful 
price to pay.

Maybe the issues with :use are such that it should go away — I've certainly 
argued that point to some extent in the past.  We have refer to fall back on, 
after all.  Clojure's ns as-is is a helluva local maxima.

FYI, I'm only speaking about Clojure here.

- Chas

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

Re: ClojureScript Compile errors

2011-08-06 Thread Rich Hickey
In Clojure, namespaces are different from the host's packages, in  
ClojureScript they are the same (insofar as they match the Google  
Closure approach).


Why all the attention to :use - I thought everyone agreed using it is  
a bad idea?


In any case, ClojureScript is a subset and right now that subset  
doesn't include :use. People who want it will have to explain why they  
think it's important. Its cost is that namespaces have to be  
enumerable, which poses challenges for code (re)loading and modularity  
for Clojure. The only benefit I see is that you can avoid a (minimum 2  
character) prefix.


Rich

On Aug 5, 2011, at 9:12 PM, pmbauer wrote:

In Clojure, there is a clear distinction between using Clojure  
namespaces and importing interop packages.

Is it a goal then to blur that line in ClojureScript?
'use' couldn't be used analogously just for ClojureScript names as  
it is in Clojure?




On Friday, August 5, 2011 5:14:36 PM UTC-7, Rich Hickey wrote:On Aug  
5, 2011, at 3:06 PM, David Nolen wrote:

 On Fri, Aug 5, 2011 at 2:51 PM, Fogus mef...@gmail.com wrote:
 The following lines looks problematic:

(ns mainpage
(:use lib.dom-helpers))

 That is, ClojureScript only supports the (ns foo (:require [a.b :as
 c])) form.  Try changing your ns declaration accordingly.

 The error message could be slightly better I agree.  ;-)

 :F

 Is there any particular reason / design rationale to not support  
use?



:use requires the ability to determine all the names in a namespace,
something we don't generally have in ClojureScript, especially for JS
pseudo-namespaces.

Rich




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


Re: ClojureScript Compile errors

2011-08-06 Thread Mark Engelberg
On Sat, Aug 6, 2011 at 2:30 PM, Rich Hickey richhic...@gmail.com wrote:
 Why all the attention to :use - I thought everyone agreed using it is a bad 
 idea?
...
 The only benefit
 I see is that you can avoid a (minimum 2 character) prefix.

The other benefit is it saves you from the cognitive load of having to
know exactly what namespace every given function comes from in order
to use it.

For some libraries the burden of knowing which namespace a function
comes from is significant (e.g., Incanter).

Also, those namespace prefixes really get in the way if you are
defining a DSL, or redefining things from Clojure's core (e.g.,
because you want to use an enriched cond macro).

In a nutshell, when working within a specific domain, sometimes you
want to take a certain set of functions/macros as primitive to your
program, and don't want to constantly have to think of the details of
how the library that defines them is structured.

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


Re: ClojureScript Compile errors

2011-08-06 Thread Ken Wesson
On Sat, Aug 6, 2011 at 6:42 PM, Mark Engelberg mark.engelb...@gmail.com wrote:
 On Sat, Aug 6, 2011 at 2:30 PM, Rich Hickey richhic...@gmail.com wrote:
 Why all the attention to :use - I thought everyone agreed using it is a bad 
 idea?
 ...
 The only benefit
 I see is that you can avoid a (minimum 2 character) prefix.

 The other benefit is it saves you from the cognitive load of having to
 know exactly what namespace every given function comes from in order
 to use it.

 For some libraries the burden of knowing which namespace a function
 comes from is significant (e.g., Incanter).

 Also, those namespace prefixes really get in the way if you are
 defining a DSL, or redefining things from Clojure's core (e.g.,
 because you want to use an enriched cond macro).

 In a nutshell, when working within a specific domain, sometimes you
 want to take a certain set of functions/macros as primitive to your
 program, and don't want to constantly have to think of the details of
 how the library that defines them is structured.

+1, and the objections raised to :use don't apply if we require that
:only go along with it. (:use [x :only foo bar baz]) could with
minimal effort, and probably should, be available to make foo, bar,
and baz refer to such primitives.

-- 
Protege: What is this seething mass of parentheses?!
Master: Your father's Lisp REPL. This is the language of a true
hacker. Not as clumsy or random as C++; a language for a more
civilized age.

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


Re: ClojureScript Compile errors

2011-08-06 Thread pmbauer


 Why all the attention to :use - I thought everyone agreed using it is  
 a bad idea?

Really? I thought it's use was only considered bad form in the absence of 
:only 

 The only benefit I see is that you can avoid a (minimum 2  
 character) prefix.

I would think the obvious benefit is its inclusion makes it easier port and 
share code between ClojureScript and Clojure.
Every difference beyond the necessary (interop, no runtime compiler) makes 
re-use that much more difficult (see macro use, binding semantics, numerics, 
ns macro differences).
Now if that's not a target and there is no expectation of sharing then all 
this is of course a non-issue.

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

Re: ClojureScript Compile errors

2011-08-05 Thread Fogus
 how do I deal with ClojureScript compile errors? For
 instance:

Would it be possible to look at you project source?

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


Re: ClojureScript Compile errors

2011-08-05 Thread Timothy Baldridge
 Would it be possible to look at you project source?


Sure this is all the source I currently have written:

;:mode=clojure:

(ns lib.dom-helpers
(:require [goog.dom :as dom]
  [goog.dom.classes :as classes]))

(defn find-node [search]
(if (keyword? search)
(dom/getElement (name search))
(let [type (first search)
  kname (subs search 1)]
  (cond (= type \.)
(dom/getElementsByClass kname)
(= type \#)
[(dom/getElement kname)]
(defn children [node]
(interate dom/getNextElementSibling (dom/getChildElement node)))

(defn remove-class [node class]
(classes/remove node class))

(defn add-class [node class]
(classes/add node class))

- cut -

;:mode=clojure:

(ns mainpage
(:use lib.dom-helpers))

(defn top-bar-hover [id idx]
(doseq (map #(remove-class % selected)
 (children (find-node #topbar
(add-class (first (find-class (str # id)

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


Re: ClojureScript Compile errors

2011-08-05 Thread Fogus
The following lines looks problematic:

(ns mainpage
(:use lib.dom-helpers))

That is, ClojureScript only supports the (ns foo (:require [a.b :as
c])) form.  Try changing your ns declaration accordingly.

The error message could be slightly better I agree.  ;-)

:F

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


Re: ClojureScript Compile errors

2011-08-05 Thread David Nolen
On Fri, Aug 5, 2011 at 2:51 PM, Fogus mefo...@gmail.com wrote:

 The following lines looks problematic:

(ns mainpage
(:use lib.dom-helpers))

 That is, ClojureScript only supports the (ns foo (:require [a.b :as
 c])) form.  Try changing your ns declaration accordingly.

 The error message could be slightly better I agree.  ;-)

 :F


Is there any particular reason / design rationale to not support use?

David

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

Re: ClojureScript Compile errors

2011-08-05 Thread pmbauer
You don't need 'use' in production? ;)
*ducks*

On Friday, August 5, 2011 12:06:29 PM UTC-7, David Nolen wrote:

 On Fri, Aug 5, 2011 at 2:51 PM, Fogus mef...@gmail.com wrote:

 The following lines looks problematic:

(ns mainpage
(:use lib.dom-helpers))

 That is, ClojureScript only supports the (ns foo (:require [a.b :as
 c])) form.  Try changing your ns declaration accordingly.

 The error message could be slightly better I agree.  ;-)

 :F


 Is there any particular reason / design rationale to not support use?

 David 


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

Re: ClojureScript Compile errors

2011-08-05 Thread Rich Hickey

On Aug 5, 2011, at 3:06 PM, David Nolen wrote:


On Fri, Aug 5, 2011 at 2:51 PM, Fogus mefo...@gmail.com wrote:
The following lines looks problematic:

   (ns mainpage
   (:use lib.dom-helpers))

That is, ClojureScript only supports the (ns foo (:require [a.b :as
c])) form.  Try changing your ns declaration accordingly.

The error message could be slightly better I agree.  ;-)

:F

Is there any particular reason / design rationale to not support use?



:use requires the ability to determine all the names in a namespace,  
something we don't generally have in ClojureScript, especially for JS  
pseudo-namespaces.


Rich

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


Re: ClojureScript Compile errors

2011-08-05 Thread pmbauer
In Clojure, there is a clear distinction between using Clojure namespaces 
and importing interop packages.
Is it a goal then to blur that line in ClojureScript?
'use' couldn't be used analogously just for ClojureScript names as it is in 
Clojure?



On Friday, August 5, 2011 5:14:36 PM UTC-7, Rich Hickey wrote:

 On Aug 5, 2011, at 3:06 PM, David Nolen wrote:

  On Fri, Aug 5, 2011 at 2:51 PM, Fogus mef...@gmail.com wrote:
  The following lines looks problematic:
 
 (ns mainpage
 (:use lib.dom-helpers))
 
  That is, ClojureScript only supports the (ns foo (:require [a.b :as
  c])) form.  Try changing your ns declaration accordingly.
 
  The error message could be slightly better I agree.  ;-)
 
  :F
 
  Is there any particular reason / design rationale to not support use?
 

 :use requires the ability to determine all the names in a namespace,  
 something we don't generally have in ClojureScript, especially for JS  
 pseudo-namespaces.

 Rich



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

ClojureScript Compile errors

2011-08-04 Thread Timothy Baldridge
So I used to think the stacktraces from Clojure were a bit
cryptichow do I deal with ClojureScript compile errors? For
instance:

bin/cljsc ~/projects/WebSite/src/WebSite/CLJS  ~/test.js
Exception in thread main java.lang.UnsupportedOperationException:
nth not supported on this type: Symbol
at clojure.lang.RT.nthFrom(RT.java:835)
at clojure.lang.RT.nth(RT.java:785)
at 
cljs.compiler$eval723$fn__725$fn__732$fn__735.invoke(compiler.clj:783)
at clojure.core$map$fn__3839.invoke(core.clj:2433)
at clojure.lang.LazySeq.sval(LazySeq.java:42)
at clojure.lang.LazySeq.seq(LazySeq.java:60)
at clojure.lang.RT.seq(RT.java:466)
at clojure.core$seq.invoke(core.clj:133)
at clojure.core$reduce.invoke(core.clj:5985)
at clojure.core$into.invoke(core.clj:5995)
at cljs.compiler$eval723$fn__725$fn__732.invoke(compiler.clj:783)
at clojure.core.protocols$fn__5607.invoke(protocols.clj:64)
at 
clojure.core.protocols$fn__5592$G__5587__5601.invoke(protocols.clj:11)
at clojure.core$reduce.invoke(core.clj:5986)
at cljs.compiler$eval723$fn__725.invoke(compiler.clj:787)
at clojure.lang.MultiFn.invoke(MultiFn.java:177)
at cljs.compiler$analyze_seq.invoke(compiler.clj:901)
at cljs.compiler$analyze.invoke(compiler.clj:954)
at cljs.compiler$analyze.invoke(compiler.clj:947)
at cljs.compiler$compile_file.invoke(compiler.clj:1141)
at cljs.compiler$compile_root.invoke(compiler.clj:1221)
at cljs.closure$compile_dir.invoke(closure.clj:235)
at cljs.closure$eval1151$fn__1152.invoke(closure.clj:265)
at cljs.closure$eval1087$fn__1088$G__1078__1095.invoke(closure.clj:187)
at cljs.closure$eval1138$fn__1139.invoke(closure.clj:280)
at cljs.closure$eval1087$fn__1088$G__1078__1095.invoke(closure.clj:187)
at cljs.closure$build.invoke(closure.clj:702)
at user$eval1286.invoke(cljsc.clj:21)
at clojure.lang.Compiler.eval(Compiler.java:6406)
at clojure.lang.Compiler.load(Compiler.java:6843)
at clojure.lang.Compiler.loadFile(Compiler.java:6804)
at clojure.main$load_script.invoke(main.clj:282)
at clojure.main$script_opt.invoke(main.clj:342)
at clojure.main$main.doInvoke(main.clj:426)
at clojure.lang.RestFn.invoke(RestFn.java:421)
at clojure.lang.Var.invoke(Var.java:405)
at clojure.lang.AFn.applyToHelper(AFn.java:163)
at clojure.lang.Var.applyTo(Var.java:518)
at clojure.main.main(main.java:37)

If I actually knew where the error was from (in what .cljs file?) it
might help.

Timothy

-- 
“One of the main causes of the fall of the Roman Empire was
that–lacking zero–they had no way to indicate successful termination
of their C programs.”
(Robert Firth)

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