2:52 jamii_: whats the clojure equivalent of import myPackage.* ? I tried (import '(myPackage)) and (import '(myPackage *)). Is there some keyword for it?
2:56 hoeck: jamii_: there is no clojure equvalent for that
2:57 jamii_: Ok. Do you have any idea what would cause java.lang.UnsatisfiedLinkError?
2:57 jamii_: no, sorry
2:57 jamii_: Hmm. To google
3:01 Ah, its a jni error. Probably nothing to do with clojure then
5:02 rhickey: where's cgrand these days?
5:25 Chouser: He connected momentarily yesterday at 3:42 AM.
5:33 I think that's 9:42 PM in France.
5:35 jamii_: If I reflect on a generated proxy what type will I see for the method?
5:36 Im trying to get QtJambi to work nicely with clojure but I need to be able to write slots like: slider.valueChanged.connect(lcd, "display(int)");
5:36 Chouser: jamii_: You can't make up new methods in a proxy, so I would expect the method types to match those of the base classes.
5:38 jamii_: I got QtJambi working a little at one point, but it wants to run in the main thread, and I didn't take the time to figure out how to manage that correctly.
5:38 jamii_: Im intending to let it run in the main thread and have a terminal in my app which sends text to eval
5:39 I think I misunderstood how proxies word
5:41 I guess I need to use gen-and-load-class to make my own slots
5:43 Chouser: I don't think I tried making up my own new slots, just connecting existing buttons and widgets. I didn't get very far.
5:43 But yes I think you're right, you'll need to use gen-class.
5:44 I wonder if you could generate classes on the fly with a slot matching the connection you need, and wrap it all up so the clojure API just accepts a signal and a fn.
5:48 jamii_: I think so. I would have to gensym the class name and be careful to match up the types, but it seems reasonable
5:49 Unable to resolve symbol: gen-and-load-class in this context
5:52 Chouser: what version of Clojure are you using?
5:52 and why can't I find my jambi .clj experiment??
5:52 jamii_: not sure. downloading the most recent just now
5:55 Is june 12th new enough? Thats the most recent packaged version
5:58 Chouser: that's probably usable. There's newer in SVN. With the June 12th release you probably need to load the gen-class.clj manually.
6:07 jamii_: Have I done something stupid here? (gen-and-load-class 'BoolSlot ( :methods [['slot [Boolean] Void]] ))
6:07 Im getting
6:07 java.lang.IllegalArgumentException: No value supplied for key: null
6:07 at clojure.lang.PersistentHashMap.create(PersistentHashMap.java:65)
6:10 hoeck: jamii_: maybe the extra parens around ":methods [..]" are unnecessary
6:11 jamii_: Thanks, that was the problem. Going to take me a while to get used to all these parentheses
6:13 hoeck: jamii_: but i think clojure does a good job in removing extra levels of parens in let and cond (compared to common-lisp or scheme)
6:13 jamii_: I've not used either. I'm a lisp virgin
6:17 Chouser: you'll probably need a package prefix on your class too. jamii.BoolSlot
6:18 jamii_: Awesome - the slot works
6:21 parth_m: Hello.
6:21 Chouser: parth_m: hi
6:21 parth_m: I downloaded the sources for clojure-contrib but don't really know how to use the contribs. Any pointers?
6:24 Chouser: well, things are in the process of changing right now. What OS are you on?
6:24 parth_m: Linux (Debian)
6:26 Chouser: great. Here's what I do (not sure how kosher this is, but it works) in my clojure-contrib dir: mkdir -p clojure; cd clojure; ln -s .. contrib
6:27 then I can run java with /home/whatever/clojure-contrib in my classpath, and lib.clj will find clojure.contrib.stuff right were it expects to (going through that little symlink)
6:28 parth_m: Ok. Will try this. So I need to (load-file lib.clj) to see all the contribs?
6:29 Chouser: Then at the top of a .clj where I want to use clojure-contrib, I can say:
6:29 (clojure.lang.RT/loadResourceScript "clojure/contrib/lib/lib.clj")
6:29 (clojure.contrib.lib/require '(clojure.contrib duck-streams))
6:29 (alias 'ds 'clojure.contrib.duck-streams)
6:30 I believe this will be simplified over the next few weeks if lib.clj gets incorporated into clojure proper.
6:30 parth_m: Is "loadResourceStript" any different from "load-file"?
6:30 "lib.clj" getting in clojure would be nice.
6:30 Chouser: yeah, loadResourceScript respects the class path. load-file just takes a plain file name.
6:31 parth_m: This helps. Thanks. Will try this.
6:31 Chouser: so as an alternative to all of the above, you could just do (load-file "/full/path/to/clojure-contrib/foo.clj"), and then do alias or refer or whatever.
6:32 parth_m: Are there any dependencies among that contribs that might break if I load an individual contrib?
6:33 I will probably go with the second method ... it seems much easier to me :)
6:33 Chouser: that's a great question. I think most of the libs stand alone.
6:33 :-) that's fine. I almost mentioned it first.
6:34 parth_m: So what is lib.clj?
6:34 Does lib mean one of the sub modules in this context?
6:37 Chouser: bah. I'm getting sloppy.
6:38 I think most of the .clj files in clojure-contrib each stand alone.
6:38 parth_m: :)
6:38 Chouser: lib.clj provides functions to make it easy to load .clj files and import the funcitons you want all in one step.
6:39 btw, if you're not using the latest svn Clojure, you may need to use a slightly older clojure-contrib as well.
6:40 right now it would be pretty tricky for any file in clojure-contrib to depend on any other without breaking a lot. Once we're all using lib.clj, that kind of interdependancy should be trivial and robust.
6:42 which is why I described the more complicated method first, because it gets you into the lib.clj world where we'll all be soon. ...but maybe not yet. :-)
7:02 Chouser: jamii_: cool!
7:03 unless your Clojure is too old, you can say "QTextEdit." instead of "new QTextEdit" if you want.
7:04 it's interesting you're using proxy with genclass like that. I hadn't thought of donig that.
7:05 you can provide an implementation for BoolSlot directly instead, but I'm not sure it's any easier.
7:06 rhickey: could use gen-interface instead
7:08 jamii_: I cant find gen-interface in the docs
7:09 Is it new(ish)?
7:09 rhickey: jamii_: yes, Chouser's latest creation :)
7:11 jamii: Im going to take a wild leap and guess that it generates an instance instead of a class? Is that an advantage here?
7:11 rhickey: generates an interface instead of a class
7:12 jamii: that was meant to say interface. the lure of qt has kept me up later than my brain can handle
7:13 rhickey: yes, it's perfect for your case - gen an interface once and proxy it many times
7:14 jamii: I wonder if theres a way to avoid having to have a different interface for each signal return type
7:15 Can any of gen-class etc handle generics?
7:16 rhickey: no
7:17 Chouser: jamii: you could write a function that whips up new interfaces on the fly for each type of slot
7:17 jamii: Yep
7:18 Was just going to wrap up what I had at the moment in a macro
7:18 Chouser: like your own connect that would take a function (instead of an Object) and the Qt slot string.
7:19 It would just have to convert the Qt slot string to a gen-interface spec, and then hook it up.
7:21 jamii: Cool. I can add syntax highlighting and error handling to this fairly easily too. Will make a nice terminal
7:39 parth_m_: Hello ... I seemed to have dropped off.
7:39 vixey: you are still here
7:39 parth_m_: Yes. :)
7:40 I was wondering if Clojure has something like CLOJUREPATH that is automatically searched for .clj files in case a "load-file" is not found in the current directory
7:42 Chouser: you can use loadResourceScript as I described above, and Java's classpath will then be used.
7:42 parth_m_: Great. Thanks.
7:43 ericthorsen: Is there clojure function for going from java class name to the clojure symbol?
7:44 rhickey: like the string "java.util.Collection" to java.util.Collection?
7:44 ericthorsen: (clojure/symbol-from-class clojure.map_123123123)
7:44 yeilds #'clojure/map
7:44 rhickey: ah
7:45 there isn't necessarily a mapping, anonymous fns and all
7:46 ericthorsen: rhickey: I need to look this up and I was trying to do it without having to build an index of all loaded clojure funcs
7:47 rhickey: to go backwards from class to the var name?
7:47 ericthorsen: yes
9:00 roblally: What's the right incantation to load parallel.clj now? I'm using HEAD and I don't have clojure-contrib on my classpath right now. The website suggests (load-file "src/parallel.clj") but that doesn't seem to be current.
9:12 rhickey: roblally: it's now in src/clj/clojure/parallel/parallel.clj
9:14 roblally: Thanks, although it seems to be in clojure/parallel/parallel.clj when I untar the jar file I built from HEAD. I loaded it using (clojure.lang.RT/loadResourceScript "clojure/parallel/parallel.clj")
9:14 At least I think I did ... jsr166 is giving me a little trouble
12:17 lpetit: hello, anybody here ?
12:17 Chouser: yep, hi.
12:17 lpetit: Time for answering a question ?
12:18 Chouser: try me. :-)
12:20 lpetit_: Yup, my IRC client seems very bad, I think I will change soon. Did you see my post concerning the problem?
12:21 Chouser: nope, sorry.
12:21 lpetit_: BTW, I seem to have inherited from another nickname
12:21 OK, so here is the problem again : I'm packaging clojure in an eclipse plugin. I'm still new as far as eclipse plugin development is concerned, but I'm quite sure I've encountered a real problem between Eclipse's way of managing ClassLoader, and the way Clojure uses them
12:22 Chouser: ah, seems plausible. This is not an area of strength for me, but I can try to help.
12:22 lpetit_: Once packaged in a plugin, when I try to access it, I get a ClassNotFoundException error while clojure is bootstraping
12:25 Here it is : java.lang.NoClassDefFoundError: clojure/lang/DynamicClassLoader. And it occurs at this point in clojure : at clojure.lang.DynamicClassLoader.findClass(DynamicClassLoader.java:52)
12:26 Chouser: I don't have any idea how eclipse manages classloaders.
12:27 lpetit_: I've found a solution that got rid of the error and allowed my Repl to function. Indeed, I've found that the root DynamicClassLoader does not reference any parent classLoader : and I think, maybe in a standard environment this may cause no harm, but in an environment such as Eclipse startup, with OSGI controlling access, it fails because there is no parent classLoader
12:27 The symptom is : DynamicClassLoader does not appear to be able to find ... itself !
12:29 Chouser: You could try setting *use-context-classloader*
12:30 lpetit_: The fix for me was : replace one line in RT.java : line 262 (in svn rev 999) was initially static final public DynamicClassLoader ROOT_CLASSLOADER = new DynamicClassLoader(); || and I replaced it with static final public DynamicClassLoader ROOT_CLASSLOADER = new DynamicClassLoader(RT.class.getClassLoader()); <== I've referenced the class loader that contains Clojure classes
12:31 Ah, could you explain me what *use-context-classloader* means ?
12:31 Chouser: if you look in RT.java, you'll see where it's referenced.
12:32 when set, the current thread's context classloader is used instead of ROOT_CLASSLOADER
12:32 I don't really know what that means, but at least it's a different classloader. :-)
12:33 on the other hand, since you have a potential fix you might try posting it to the forum to see if people think it's a good idea in general.
12:34 lpetit_: OK, that's interesting, I'm not sure for which use *use-context-classloader* could be used, but here I think it may not help, because the problem appears in Clojure's static code before I have a chance to bind this var :-(
12:34 OK, after having talked about it with you, I think indeed it's time to post my problem to the group, thanks !
12:42 Chouser: heh, sure. Sorry I'm not much help.
12:52 lpetit_: Sure you were, you told me about *use-context-classloader* which seems as another interesting path to fix the problem
20:51 krsanky: hi !