#clojure log - Sep 09 2008

The Joy of Clojure
Main Clojure site
Google Group
IRC
List of all logged dates

10:10 Chouser: "self require -> stack overflow" seems a little out of control

10:13 rhickey: Chouser: the thread?

10:14 Chouser: yeah

10:15 I'd say something, if I had something intelligent to say that would resolve anything.

12:23 kotarak: Hi. Is there some chance, that import does a similar -/_ mangling as require or use? I find myself, always doing the same stupid mistake of writing - for _. Especially in projects with mixed Clojure and Java sources.

12:24 Chouser: hm, that's an interesting idea

12:25 kotarak: I think - is not valid in Java package names. So there shouldn't be any clash anyhow.

12:26 Chouser: that's a critial point, but I think you're right

12:26 kotarak: And it would be nice to use the same package name as the namespace name in a mixed project.

12:36 OT question: is there a Java compiler, which does not include a half-baked make implementation, or which let's on turn it off at least?

12:59 scgilardi: regarding name mangling, mangling something in quotes seems kinda iffy to me. One possibility is to allow load to accept symbols and do mangling to produce namespace-relative resource paths. Then the mangling would always be symbol -> path, done consistently. One upside is giving all the arguments to ns a consistent look. One downside is explaining "either paths or symbols" in the docs. A...

12:59 ...symbol my-lib.foo.bar would signify the resource "<namespace_root_dir>/my_lib/foo/bar.clj"

12:59 load may be done rarely enough that this won't save enough effort to be worth the change.

13:00 kotarak: are you loading a lot?

13:03 Chouser: thanks very much for the log of #clojure. I'm not able to be on irc much so it helps me a lot to keep up with what's going on.

13:05 pjstadig: http://github.com/pjstadig/clj-installer/tree/master

13:05 is anyone interested in this project, or should I just delete it?

13:06 i only see it as a temporary solution until there are ebuilds, debs, or rpms

13:13 kotarak: scgilardi: sorry. was away for a second. I'm not sure, what you mean with "loading". I mostly do import with packages containing _ "belonging" to Clojure namespaces with - in the name. Having a common to write this, would be nice. One could opt for _, of course. But eg. our domain has a -. So, com.our-domain would be nicer.

13:53 Chouser: your dns domain has a - so your Java package name has a _, and you would like to use - for it in clojure?

13:54 kotarak: Yep. continental-corporation. Long but fits with dashes. :)

13:54 cemerick: a generic clojure tree framework would be super-handy...

13:54 Chouser: cemerick: tree framework?

13:55 kotarak: I bet that would fly. You might suggest it on the forum.

13:55 kotarak: you mean the group?

13:55 Chouser: kotarak: yep

13:56 kotarak: ok. Will do.

13:56 cemerick: Chouser: yeah, some foundations for implementing various tree structures. Scala has something along those lines (which I sort of scoffed at a while ago, but now that I'm implementing my third tree structure in two months, it suddenly seems like a good idea).

13:56 Chouser: cemerick: I'm not sure exactly what you mean. Have you looked at clojure.zip?

13:56 rhickey: cemerick: like what?

14:04 cemerick: The last time I tried to understand zippers, I drowned in haskell. The dreams are the worst. ;-)

14:05 kotarak: rhickey: is there a particular reason, why one would not want to force a Delay directly? But via Delay.force(theDelay)?

14:05 Chouser: well, I've managed to use clojure.zip quite a bit without *quite* understanding it.

14:06 rhickey: kotarak: instead of using (force d)?

14:09 kotarak: rhickey: of course this is not the question. (force d) is perfect. :) But I have to access the value from the Java side of the interface. At least I have no better idea, how to do it differently in clojure at the moment. (Tried with proxy before, but that had it's own quirks.)

14:47 Chouser: Well, I just tried compiling clojure.lang with GWTCompiler

14:48 I must be doing something wrong, because it delete all the clojure .java files and then threw an exception and died.

14:48 kotarak: It didn't like you. ;)

14:49 Chouser: Apparently not.

14:49 pjstadig: it's a feature, not a bug

14:49 kotarak: Clean up, before going to work?

14:52 Chouser: ah, that's better. output directory defaulted to cwd. Adding "-o www" fixed it.

14:52 Now I have real errors.

14:53 rhickey: Chouser: trying to take the easy way out of implementing ClojureScript? :)

14:53 Chouser: of course!

14:54 Although I'm only really hoping for the persistent collections.

14:54 If all the rest worked I'd get what, a JavaScript implementation of a Clojure-to-JVM compiler?? :-)

14:55 * rhickey woke up thinking about how to get both ClojureScript and AOT compilation by targeting JavaScript and Java from the current analysis tree...

14:57 Chouser: hm!

14:57 but you'd still need persistent collections in JavaScript, right? So I'll proceed on this particular goose chase.

15:13 The type PersistentTreeMap must implement the inherited abstract method Collection.remove(Object)

15:15 rhickey: Chouser: what happened to APersistentMap, which implements remove()?

15:16 Chouser: thanks for the pointer. Don't know yet.

16:04 well now I think I'm doing things "right", but there are a lot of classes and methods used by clojure.lang that aren't provided by gwt.

16:12 shoover: Chouser: that is unfortunate. clojure does import quite a few classes, and I was also reading that GWT provides no reflection capabilities nor assumes any threading capability. I wonder if that will change with Chrome and V8 vm and built in Gears

16:12 Chouser: I wouldn't hold my breath for threading in any kind of JavaScript.

16:14 I'm a little less clear how reflection will shake out. I think we won't need it for ClojureScript, since we won't need to emit any static type stuff when generating JavaScript.

16:15 there are references to java.lang.reflect in clojure.lang, but I'm hoping none of them are too critical. We'll see.

16:20 shoover: Oh, Gears' current "threading" involves asynchronous message passing, so it wouldn't work with clojure.lang's use of synchronized

16:46 StartsWithK: you can translate clojure to javascript?

16:47 Chouser: Full features Clojure cannot be translated into standard JavaScript.

16:47 s/features/featured/

16:48 StartsWithK: but you can translate some subset?

16:48 Chouser: It should be possible.

16:51 cemerick: Chouser: I'm absolutely not a js hacker, but is having a js-only stack important enough to avoid loading clojure up in an applet and calling into it via javascript? It seems that, even if you can translate a subset, you still won't have the DOM, event model, etc.

16:51 (that's totally aside from the cool factor, of course)

16:54 Chouser: For me, the point would be to have access to the browser API (DOM, XmlHttpRequest, events, etc.) without giving up all of Clojure for JavaScript. How much of Clojure I would get to keep (or would need) isn't entirely clear to me.

16:54 Minimally I'd want macros and the seq library. Probably immutable collections.

16:55 StartsWithK: you could access all of that with liveconnect from clojure applet

16:56 cemerick: yeah, that's what I was getting at

16:56 Chouser: A Clojure applet requires a separate security step during load, plus a pretty hefty CPU and memory hit at page load.

16:57 rhickey: cemerick: did you ever explain what you wanted, tree-wise?

16:57 cemerick: rhickey: no, I got sucked back into reading about zippers :-)

16:57 Chouser: there are probably some applications where that would be acceptible, but I certainly have some places I'd like to use ClojureScript where those would be non-starters.

16:57 StartsWithK: Chouser: only first time when it is loaded, and if you don't want to scare users with certificate prompt i guess you could buy one

16:58 abrooks: Chouser: A hefty CPU and memory hit to comile the Clojure code or just the usual hit that a Java applet would be?

16:58 Chouser: abrooks: both, summed together I would suppose.

16:58 abrooks: ^comile^compile

16:59 rhickey: applets and ClojureScript are two very different use cases, IMO

16:59 Chouser: If you're writing a gmail-sized app, a Clojure applet controlling the DOM or perhaps a whole-window-sized applet might be worth exporing.

17:00 abrooks: Chouser: Gotcha. Is the Clojure compile step noticable beyond normal Java Applet startup though? I would think not.

17:00 rhickey: or just Java Web Start

17:01 StartsWithK: applets now use web starts jnlp

17:01 Chouser: If you have a mostly static page, but want to decorate with a few non-critical features (a little animation, or incremental data retrieval and display, etc.) then loading a whole java applet + compiling boot.clj for every page load is a poor option.

17:01 StartsWithK: no difference anymore, they all cache jars to local storage

17:01 rhickey: Chouser: or run on iPhone etc

17:02 StartsWithK: clojure.jar is now 450kb, when that is translated to javascript, will the size be reduced?

17:03 rhickey: half of clojure.jar is ASM

17:04 in any case I don't thnk there will be parity, ClojureScript will be a subset of Clojure

17:04 StartsWithK: will gwt for 200kb of .class files produce 200kb of .js files? or it can reduce size too?

17:22 Chouser: I've not done enough with GWT to know how much .js is produced, but GWT may not even be used for ClojureScript -- I'm just experimenting with it.

17:40 "Cannot invoke clone() on the array type Object[]"

17:42 rhickey: Chouser: you are a JS whiz, wanna try a manual port of PersistentVector?

17:42 I don;t think GWT is going to get it done

17:42 Chouser: heh. yeah, I figured I was being pretty optimistic.

17:43 I'm not scared of a manual port. PersistentVector is the right place to start?

17:44 rhickey: I think the 2 we really need are vector and hash-map, the latter has more Java OO-ness, vector just needs arrays

17:44 Chouser: I'm not a sufficient JS whiz to know what structures are generally the fastest, to use in place of Java arrays inside the Collections for example.

17:44 rhickey: doesn;t JS have arrays?

17:44 Chouser: well, yeah it does.

17:45 rhickey: probably those

17:45 Chouser: hm

17:45 :-)

17:45 rhickey: at least to get it going

17:45 Chouser: ok, I guess I was thinking for objects -- closures vs. hashes.

17:46 blackdog: there's a scheme to j2 compiler at inria if that's useful to you

17:46 Chouser: aw, scrap that too. nm.

17:46 blackdog: http://www-sop.inria.fr/mimosa/scheme2js/

17:47 rhickey: GPL, stay away from that for Clojure

17:47 blackdog: oh :/

17:48 rhickey: Clojure's data structures are going to be needed and not present in a Scheme anyway

17:51 anyone know how to get Ant to use JDK 6 on OS X? Using the Java Preferences util doesn't do it

17:51 jamii: is there a good reason that ns symbols don't evaluate to their ns?

17:52 rhickey: jamii: why should they?

17:53 OTOH, I think the ns-* functions should take the symbols as well, is that what you are after?

17:53 jamii: I'm porting (loosely) plt scheme's units. it would unify the module/unit syntax.

17:54 rhickey: jamii: namespace names are just designators, there's no corresponding var

17:55 jamii: I want to add a dynamic lookup to the reader eg clojure//refer would lookup the refer symbol everytime it is run, rather than at compile time. it would allow for erlang style hotswapping and allow units and modules to use the same syntax

17:57 rhickey: jamii: there's a lot in that sentence - first off, looking up a symbol again won't find anything different there

17:57 what gets bound into compiled code is the var, not its value, so swapping works already

17:57 and I don't know what units and modules are

17:58 :)

17:58 jamii: Ok. How about I go away and write a proper explanation and email it to you?

17:58 rhickey: ok

17:58 or put on the group, please

18:04 StartsWithK: rhickey: i thinky you will need to set JAVA_HOME before you call ant (or majbe JAVACMD)

18:04 rhickey: StartsWithK: found that, thanks

18:20 Chouser: if a java method isn't declared public or private, what is it?

18:21 oh, it's declared final if that matters.

18:22 rhickey: Chouser: package

18:22 http://java.sun.com/docs/books/tutorial/java/javaOO/accesscontrol.html

18:25 Chouser: huh

19:20 rhickey: any particular reason why you use arr.clone() some places and new Object[] + System.arraycopy in another?

19:23 rhickey: Chouser: yes

19:24 clone() when it's going to be the same size, new otherwise

19:26 Chouser: Ok, PeresistentVector.java line 86 appears to use new for a same-size copy, unless I'm misreading it.

19:29 rhickey: that could be a clone then - I don't know that I ever saw a difference

19:30 Chouser: I don't have either in JavaScript. :-)

19:30 rhickey: ouvh

19:30 ouch

19:30 Chouser: well, I have "new", but no arraycopy or clone.

19:30 but Array.splice seems good enough so far

19:30 Array.slice, rather

19:51 meredydd: rhickey: What's your current thinking on reader/writer customisability?

19:51 I understand you're very much agin reader macros

19:52 but ISTR you talking about writing and reading stuff with multimethod-like behaviour

19:52 rhickey: meredydd: there is a contribution that make print a multimethod I've yet to incorporate

19:53 patch is in the group file section

19:53 meredydd: k

19:58 Chouser: I wonder whether PersistentVector.js will actually be any faster than a splice-on-write implementation, for the most common uses of Vector in ClojureScript.

20:01 rhickey: Chouser: that is a fair question

20:02 doing something fancier is just an optimization

20:15 * meredydd hates hates hates parsing.

20:16 meredydd: I really wish there were a bit of the reader I could pull out and use for this.

20:16 jamii: read?

20:17 meredydd: (Plus, I get a definite feeling I must be Doing It Wrong to be doing character-level ops to splice something into Clojure code)

20:18 jamii: I'm trying to write HTML templates spliced into Clojure code

20:18 (a la PHP, or RHTML)

20:18 which, effectively, means inventing a new sort of quoting syntax.

20:56 Chouser: meredydd: have you seen how websure uses ` ~ and ~@ ?

20:56 meredydd: do you mean Webjure? Or was that 's' deliberate?

20:57 jamii: does in-ns affect the current thread only, or every thread? For example if I had several repls running in different threads and used in-ns in one of them would the others be affected?

20:58 meredydd: In any case - I'm just being ornery and opinionated (so what's new) - I actually don't like writing HTML as S-expressions

20:59 (Or rather, *I* like it very much, but I can't expect everyone else who might encounter this project to learn Clojure)

20:59 Chouser: meredydd: yeah, sorry. apparently I'm very bad at typing.

21:00 jamii: it's based on binding, which is thread-local.

21:00 jamii: thanls

21:00 *thanks

Logging service provided by n01se.net