#clojure logs

2008-09-09

10:10Chouser"self require -> stack overflow" seems a little out of control
10:13rhickeyChouser: the thread?
10:14Chouseryeah
10:15ChouserI'd say something, if I had something intelligent to say that would resolve anything.
12:23kotarakHi. 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:24Chouserhm, that's an interesting idea
12:25kotarakI think - is not valid in Java package names. So there shouldn't be any clash anyhow.
12:26Chouserthat's a critial point, but I think you're right
12:26kotarakAnd it would be nice to use the same package name as the namespace name in a mixed project.
12:36kotarakOT 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:59scgilardiregarding 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:59scgilardi...symbol my-lib.foo.bar would signify the resource "<namespace_root_dir>/my_lib/foo/bar.clj"
12:59scgilardiload may be done rarely enough that this won't save enough effort to be worth the change.
13:00scgilardikotarak: are you loading a lot?
13:03scgilardiChouser: 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:05pjstadighttp://github.com/pjstadig/clj-installer/tree/master
13:05pjstadigis anyone interested in this project, or should I just delete it?
13:06pjstadigi only see it as a temporary solution until there are ebuilds, debs, or rpms
13:13kotarakscgilardi: 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:53Chouseryour dns domain has a - so your Java package name has a _, and you would like to use - for it in clojure?
13:54kotarakYep. continental-corporation. Long but fits with dashes. :)
13:54cemericka generic clojure tree framework would be super-handy...
13:54Chousercemerick: tree framework?
13:55Chouserkotarak: I bet that would fly. You might suggest it on the forum.
13:55kotarakyou mean the group?
13:55Chouserkotarak: yep
13:56kotarakok. Will do.
13:56cemerickChouser: 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:56Chousercemerick: I'm not sure exactly what you mean. Have you looked at clojure.zip?
13:56rhickeycemerick: like what?
14:04cemerickThe last time I tried to understand zippers, I drowned in haskell. The dreams are the worst. ;-)
14:05kotarakrhickey: is there a particular reason, why one would not want to force a Delay directly? But via Delay.force(theDelay)?
14:05Chouserwell, I've managed to use clojure.zip quite a bit without *quite* understanding it.
14:06rhickeykotarak: instead of using (force d)?
14:09kotarakrhickey: 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:47ChouserWell, I just tried compiling clojure.lang with GWTCompiler
14:48ChouserI must be doing something wrong, because it delete all the clojure .java files and then threw an exception and died.
14:48kotarakIt didn't like you. ;)
14:49ChouserApparently not.
14:49pjstadigit's a feature, not a bug
14:49kotarakClean up, before going to work?
14:52Chouserah, that's better. output directory defaulted to cwd. Adding "-o www" fixed it.
14:52ChouserNow I have real errors.
14:53rhickeyChouser: trying to take the easy way out of implementing ClojureScript? :)
14:53Chouserof course!
14:54ChouserAlthough I'm only really hoping for the persistent collections.
14:54ChouserIf all the rest worked I'd get what, a JavaScript implementation of a Clojure-to-JVM compiler?? :-)
14:57Chouserhm!
14:57Chouserbut you'd still need persistent collections in JavaScript, right? So I'll proceed on this particular goose chase.
15:13ChouserThe type PersistentTreeMap must implement the inherited abstract method Collection.remove(Object)
15:15rhickeyChouser: what happened to APersistentMap, which implements remove()?
15:16Chouserthanks for the pointer. Don't know yet.
16:04Chouserwell 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:12shooverChouser: 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:12ChouserI wouldn't hold my breath for threading in any kind of JavaScript.
16:14ChouserI'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:15Chouserthere are references to java.lang.reflect in clojure.lang, but I'm hoping none of them are too critical. We'll see.
16:20shooverOh, Gears' current "threading" involves asynchronous message passing, so it wouldn't work with clojure.lang's use of synchronized
16:46StartsWithKyou can translate clojure to javascript?
16:47ChouserFull features Clojure cannot be translated into standard JavaScript.
16:47Chousers/features/featured/
16:48StartsWithKbut you can translate some subset?
16:48ChouserIt should be possible.
16:51cemerickChouser: 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:51cemerick(that's totally aside from the cool factor, of course)
16:54ChouserFor 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:54ChouserMinimally I'd want macros and the seq library. Probably immutable collections.
16:55StartsWithKyou could access all of that with liveconnect from clojure applet
16:56cemerickyeah, that's what I was getting at
16:56ChouserA Clojure applet requires a separate security step during load, plus a pretty hefty CPU and memory hit at page load.
16:57rhickeycemerick: did you ever explain what you wanted, tree-wise?
16:57cemerickrhickey: no, I got sucked back into reading about zippers :-)
16:57Chouserthere 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:57StartsWithKChouser: 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:58abrooksChouser: A hefty CPU and memory hit to comile the Clojure code or just the usual hit that a Java applet would be?
16:58Chouserabrooks: both, summed together I would suppose.
16:58abrooks^comile^compile
16:59rhickeyapplets and ClojureScript are two very different use cases, IMO
16:59ChouserIf 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:00abrooksChouser: Gotcha. Is the Clojure compile step noticable beyond normal Java Applet startup though? I would think not.
17:00rhickeyor just Java Web Start
17:01StartsWithKapplets now use web starts jnlp
17:01ChouserIf 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:01StartsWithKno difference anymore, they all cache jars to local storage
17:01rhickeyChouser: or run on iPhone etc
17:02StartsWithKclojure.jar is now 450kb, when that is translated to javascript, will the size be reduced?
17:03rhickeyhalf of clojure.jar is ASM
17:04rhickeyin any case I don't thnk there will be parity, ClojureScript will be a subset of Clojure
17:04StartsWithKwill gwt for 200kb of .class files produce 200kb of .js files? or it can reduce size too?
17:22ChouserI'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:40Chouser"Cannot invoke clone() on the array type Object[]"
17:42rhickeyChouser: you are a JS whiz, wanna try a manual port of PersistentVector?
17:42rhickeyI don;t think GWT is going to get it done
17:42Chouserheh. yeah, I figured I was being pretty optimistic.
17:43ChouserI'm not scared of a manual port. PersistentVector is the right place to start?
17:44rhickeyI think the 2 we really need are vector and hash-map, the latter has more Java OO-ness, vector just needs arrays
17:44ChouserI'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:44rhickeydoesn;t JS have arrays?
17:44Chouserwell, yeah it does.
17:45rhickeyprobably those
17:45Chouserhm
17:45Chouser:-)
17:45rhickeyat least to get it going
17:45Chouserok, I guess I was thinking for objects -- closures vs. hashes.
17:46blackdogthere's a scheme to j2 compiler at inria if that's useful to you
17:46Chouseraw, scrap that too. nm.
17:46blackdoghttp://www-sop.inria.fr/mimosa/scheme2js/
17:47rhickeyGPL, stay away from that for Clojure
17:47blackdogoh :/
17:48rhickeyClojure's data structures are going to be needed and not present in a Scheme anyway
17:51rhickeyanyone know how to get Ant to use JDK 6 on OS X? Using the Java Preferences util doesn't do it
17:51jamiiis there a good reason that ns symbols don't evaluate to their ns?
17:52rhickeyjamii: why should they?
17:53rhickeyOTOH, I think the ns-* functions should take the symbols as well, is that what you are after?
17:53jamiiI'm porting (loosely) plt scheme's units. it would unify the module/unit syntax.
17:54rhickeyjamii: namespace names are just designators, there's no corresponding var
17:55jamiiI 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:57rhickeyjamii: there's a lot in that sentence - first off, looking up a symbol again won't find anything different there
17:57rhickeywhat gets bound into compiled code is the var, not its value, so swapping works already
17:57rhickeyand I don't know what units and modules are
17:58rhickey:)
17:58jamiiOk. How about I go away and write a proper explanation and email it to you?
17:58rhickeyok
17:58rhickeyor put on the group, please
18:04StartsWithKrhickey: i thinky you will need to set JAVA_HOME before you call ant (or majbe JAVACMD)
18:04rhickeyStartsWithK: found that, thanks
18:20Chouserif a java method isn't declared public or private, what is it?
18:21Chouseroh, it's declared final if that matters.
18:22rhickeyChouser: package
18:22rhickeyhttp://java.sun.com/docs/books/tutorial/java/javaOO/accesscontrol.html
18:25Chouserhuh
19:20Chouserrhickey: any particular reason why you use arr.clone() some places and new Object[] + System.arraycopy in another?
19:23rhickeyChouser: yes
19:24rhickeyclone() when it's going to be the same size, new otherwise
19:26ChouserOk, PeresistentVector.java line 86 appears to use new for a same-size copy, unless I'm misreading it.
19:29rhickeythat could be a clone then - I don't know that I ever saw a difference
19:30ChouserI don't have either in JavaScript. :-)
19:30rhickeyouvh
19:30rhickeyouch
19:30Chouserwell, I have "new", but no arraycopy or clone.
19:30Chouserbut Array.splice seems good enough so far
19:30ChouserArray.slice, rather
19:51meredyddrhickey: What's your current thinking on reader/writer customisability?
19:51meredyddI understand you're very much agin reader macros
19:52meredyddbut ISTR you talking about writing and reading stuff with multimethod-like behaviour
19:52rhickeymeredydd: there is a contribution that make print a multimethod I've yet to incorporate
19:53rhickeypatch is in the group file section
19:53meredyddk
19:58ChouserI 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:01rhickeyChouser: that is a fair question
20:02rhickeydoing something fancier is just an optimization
20:16meredyddI really wish there were a bit of the reader I could pull out and use for this.
20:16jamiiread?
20:17meredydd(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:18meredyddjamii: I'm trying to write HTML templates spliced into Clojure code
20:18meredydd(a la PHP, or RHTML)
20:18meredyddwhich, effectively, means inventing a new sort of quoting syntax.
20:56Chousermeredydd: have you seen how websure uses ` ~ and ~@ ?
20:56meredydddo you mean Webjure? Or was that 's' deliberate?
20:57jamiidoes 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:58meredyddIn any case - I'm just being ornery and opinionated (so what's new) - I actually don't like writing HTML as S-expressions
20:59meredydd(Or rather, *I* like it very much, but I can't expect everyone else who might encounter this project to learn Clojure)
20:59Chousermeredydd: yeah, sorry. apparently I'm very bad at typing.
21:00Chouserjamii: it's based on binding, which is thread-local.
21:00jamiithanls
21:00jamii*thanks