#clojure logs

2008-07-17

07:00StartsWithKhi
07:01rhickey_hey
07:01StartsWithKdid any one created osgi bundle that can use clojure?
07:01StartsWithKi have no luck with creating one
07:01StartsWithKwhat i did is
07:02StartsWithKi created regular bundle (with scala, but its sam as java version)
07:02StartsWithKand in manifest file included Bundle-ClassPath: clojure.jar
07:02StartsWithKand included clojure.jar with my bundle
07:03StartsWithKi think RT class would be global to all bundles if it was registered as separate bundle
07:03StartsWithKbun when i try to call some method on RT i get..
07:04StartsWithKjava.lang.ExceptionInitilizerError
07:05StartsWithKthis happens in my Activator inside start method..
07:07rhickey_I don't know osgi, but it could be that RT can't find boot.clj etc in the classpath
07:08StartsWithKi even tryed to call something like RT.nextID ..
07:08StartsWithKis there a way for clojure to dump me some kind of log of what it is doing?
07:09StartsWithKhmm.. maybe it is that
07:09StartsWithKshould i maybe copy all of clojure.jar files directly to my bundle?
08:08rhickey_I've changed eval so the stack traces should be much shorter and more relevant
08:35cemerickrhickey_: That's *very* exciting.
10:00meredyddhttp://pastebin.com/m4be0b624
10:01meredyddOoo. And I look at scrollback, and see rhickey has addressed that issue too
10:28ChouserI've got rhickey's changes built, but I haven't tried them out yet.
10:29rhickey_try (+ "a" 2) before and after the change
10:36ChouserAnyone looked at Google's protocol buffers? "Order of magnitude faster than xml" sounds interesting.
10:36Chouserhttp://code.google.com/apis/protocolbuffers/docs/overview.html
10:37rhickey_ugh, IDL
10:40rhickey_Many people wish they had Google's problems, but they don't
10:40Chouserheh. good point.
10:41rhickey_I'm no fan of XML, but I would prefer optimizations oriented around - "here's the first set of tags, all the children will have the same set so I'll leave them out", which would still be dynamic
10:42rhickey_and XML closing tags are an abomination
10:43ChouserI guess I'm an XML fan if not a fan-boy. It's better than anything else I've heard of that acheived such broad acceptance.
10:44abrooksI continue to share some level of Brett's annoyance at the inconsistency between attributes and sub-tags.
10:44ChouserASN.1 is no good. I've only heard bad things about DIF. etc.
10:46Chousersure, there's plenty of things wrong with XML. But what's right: dynamic, namespaced, heirarchical, char-encoding-aware, widely used.
10:47ChouserI like JSON too for a lot of applications, but it's missing at least 2 of those.
10:47albinoHow is xml dynamic?
10:47rhickey_read/print
10:48abrooksChouser: Have you presented the alternate Clojure XML representation?
10:48Chousernope. It's not very different from a couple of formats people are knocking around, though.
10:49abrooksNo, it's fairly similar but I think the difference is big enough that it should be considered.
10:49rhickey_[tag {attrs} children ...]
10:49rhickey_?
10:49Chouserrhickey_: yes
10:49ChouserI think we had some namespace ideas too
10:49rhickey_attrs optional?
10:49abrooksYeah, I now need to disinter those dead brain cells to remember that.
10:50abrooksYes, attrs optional.
10:50abrooksI think.
10:50abrooksIs that what we said?
10:50Chouserrhickey_: I want parse, zip, and emit support for that format. (and was planning to write it if nobody else did)
10:51Chouserabrooks: yes, optional attrs for input only
10:51abrooks^middle^end
10:51abrooksChouser: Ah, that's right.
10:53Chouserrhickey_: compared to xml.clj, that's one less hash-map per xml element, and less verbose when printed.
10:54rhickey_Chouser: an early version (prior to checkin) used that format. It was one of the things that inspired subvec
10:54rhickey_I think it is ideal for human entry
10:54abrooksWhy the change?
10:54Chouserrhickey_: does it have a drawback I'm missing?
10:54rhickey_programming with it, I found it a bit precarious, as it was easy to get the wrong bits of the data structure accidentally
10:55rhickey_you'd have to use access functions always
10:55abrooksBecause of the need to conditionalize for the posibly absent attributes?
10:55Chouserxml.clj already provides accessors for tag, attrs, and content. I figured providing those would make it seamless.
10:55abrooksOff by one or two for the name and attribute slots?
10:57abrooksI think those issues are not so significant with the current set of tools. There's really not a need to touch the structure directly.
10:57rhickey_you get into a nested context and forget (content x) and use x, it's the same data structure
10:58rhickey_I'm not arguing against it, but that was my experience
11:00abrooksChouser: Did we discuss [name {attrs} [content]]?
11:00rhickey_switching back was on my todo list, but I wanted to think about those issues
11:00rhickey_abrooks: I have pages and pages of variants, including that
11:00abrooksLess nesting is still probably better.
11:00rhickey_right
11:00Chouserabrooks: not that I recall. wouldn't really help rhickey's specific example.
11:01rhickey_Chouser: I don't think optional attrs for input only works
11:01Chouseroh?
11:02rhickey_turning [a b] into [a {} b] on people will be confusing
11:02ChouserI guess input only would have to be defined -- probably by requiring use of a normalize function or something.
11:03rhickey_plus you might read a huge structure which will need translation
11:03Chouserhm. if the accessors still work correctly? I would just rather not type [:p {} "This is " [:b {} "bold"]]
11:05rhickey_I'm arguing for the opposite, leave out empty {}s, attrs and content accessors have to test the type of (element 1)
11:06Chouseroh, arguing against the "input only" part. ok.
11:07ChouserI guess if you're already requiring the use of accessors, that's not a huge deal.
11:07rhickey_right, whatever data structure is acceptable input has to work without transformation
11:08rhickey_and will discourage (drop 2 element) to get at content
11:08Chouseranother detail is that [[:tag ...] [:tag ...]] would be spliced in
11:09rhickey_?
11:11Chouserbecause I don't know how else to nicely splice in generated content
11:11Chouser[:table [:tr "heading row"] (for [r rows] [:tr r])]
11:13rhickey_user=> `[a b ~@(range 3)]
11:13rhickey_[user/a user/b 0 1 2]
11:13Chouseryeah. that's what webjure does
11:13rhickey_if you are a macro
11:16rhickey_Chouser: stiull not sure I get what you meant by [[:tag ...] [:tag ...]]
11:18Chouser[:p [:c1] [:c2] [[:c3] [:c4]] [:c5]] ... all the c's are siblings, :p is their parent
11:18rhickey_oh
11:21ChouserI don't love it, but so far I think I like it better than any alternative I've tried.
11:21rhickey_indefinitely nested?
11:22abrooksChouser: I think that plays with my head and would lead to several easy-to-commit errors.
11:23Chouserrhickey_: hm. presumably, though I haven't needed more than one level yet.
11:23abrooksIt does make merging easier.
11:24abrooksHow about sequences? [:p [:c1] [:c2] ([:c3] [:c4]) [:c5]] ?
11:24Chouserabrooks: so suggest an alternative. webjure uses a backtick at the root of the s-expr, and then ~ or ~@ before every non-literla value.
11:24Chouserabrooks: sure, seq or vector. but not written like that.
11:25abrooksOh, heh.
11:25Chouser[:p [:c1] [:c2] (list [:c3] [:c4]) [:c5]]
11:25abrooks[:p [:c1] [:c2] '([:c3] [:c4]) [:c5]] ?
11:25abrooksHm. Not the same.
11:26Chouserthat's good enough
11:26Chouserin this case
11:27Chouserthe point is, vector hash-map and keyword syntax allow beautiful self-representation without quoting using ` or '
11:27rhickey_seqs/vecs don't matter, what matters is that the entry format be directly useful as data, so (content element) would have to call some sort of flatten
11:28rhickey_also, if you are looking for easy read/modify/emit, both seqs and vecs have bad insert-in-middle perf
11:28abrooksWe can't really do this without macros...
11:28abrooksOr adding flattening functions which I think we agree are yucky.
11:28Chouserbut as soon as you quote or use a macro, you lose all that and have to convert stuff in and out of the format.
11:29rhickey_we need to clarify what we are talking about here - templating systems are another level, first thing is how is xml represented as data
11:29Chouseryou might as well then use symbols and lists instead: `(html (body ~this ~that ~@(stuff ...)))
11:33Chouserof course everyone's specific use cases are different, but when one situation I'm frequently in is one where I now reach for xslt/xpath.
11:33abrooks... and a bucket.
11:33Chouserxpath is ok, but xslt is annoying. I think I have a reasonable replacement for xpath in clojure, so I'd like to do my full round trip xml->parse->modify->xml in clojure
11:34Chouserright now, xml.clj -> zip.clj -> zip-filter.clj work nicely for the parsing and selecting.
11:35ChouserBut in order to insert new sub-trees into my zip-tree, I need to generate xml.clj's structure.
11:36Chouserdoing that with raw s-expr is verbose and error-prone (I set the :contnet of the element, why can't I see it?)
11:36abrooksAll of these nits aside, I must say that Clojure's ability to reasonably represent and process XML in a native but isomorphically structured format is amazing. Every other language you hit places where you hold your breath, unpack the XML into something usable, process and, only at the end, restructure everything for output.
11:36rhickey_Chouser: ?
11:36ChouserI've suggest to poor Lau that he provide the new content as an string and run it through xml/parse. This works but is slow and has other caviats.
11:37Chouserabrooks: isn't that what we're doing in clojure?
11:38rhickey_Chouser: when you have (content e) -> [a b d e] and you want to make it [a b c d e] what do you want to do/say?
11:39abrooksChouser: I don't mean on the bits level, I mean on the data structure level (or even above) -- how you relate and interact with the data.
11:39Chouserhm. well now that I've spewed all that, perhaps all I really want is something that consumes [:a {:href ...}] and produces {:tag :a, :attrs {:href ...}, ...}
11:39rhickey_heh
11:40Chouserthen I can make up all the fancy input semantics I want (optional {}, nested seq content, etc.)
11:40ChouserI'm pretty bad at thining unless I'm talking. *sigh*
11:41Chouserthinking
11:41abrooksWe don't have an (xml<- ...) yet do we? (We have (xml->) IIRC).
11:42Chouserabrooks: xml-> is from zip-filter, and it's -> in the sense of the builtin ->, not like C++ >> stream io or anything.
11:42Chouserabrooks: xml.clj provides parse and emit
11:43abrooksRicht. I was thining of (<- xml [:tag])
11:43abrooksDrat. There's that thining again. We must not be doing enough thinking.
11:45Chouserwell, if I write a tmpl function as described above, you could say (xml/emit (tmpl [:tag]))
11:45abrooksIs Clojure SVN still sad? I'm not getting any response.
11:45Chouserand get <tag /> ...so much better. :-/
11:45abrooksAh, no, wait... it's just horribly slow.
11:48ChouserI want to think more about xml namespaces too. They're powerful, but a lot of the APIs out there make them pretty painful to deal with.
11:49abrooksIsn't that what we were doing with optional attrs.
11:49abrooks?
11:49rhickey_abrooks: no, I mean supporting both vector (new) and map (as is today) elements
11:50abrooksAh, I see. Multiple formats simultaneously based on object types.
11:50rhickey_Chouser: at least nested : is ok now
11:50Chouserrhickey_: yep, I look forward to taking advantage of that. :-)
11:52Chouserthe problem is that you want a map of prefixes to namespace uris somewhere so that all your query and literal xml expressions can use the prefixes.
11:52Chouserso where do you put the namespace map without getting all stateful?
11:52rhickey_Chouser: I don't think the flatten required by your nested child seqs is too bad, since most reading is sequential
11:53Chouserrhickey_: I was just about to say that -- lazy-xml generates a seq instead of a vector for the content anyway, and zip and zip-filter still work great
11:56rhickey_an advantage to the canonic (current) xml data representation is that 'setting' the content is easier
11:56rhickey_so transformations of vector elements might yield map elements, but using accessors on wouldn't care
11:56rhickey_one wouldn't
11:57rhickey_Chouser: where do they go in xml?
11:57rhickey_namespaces
11:58rhickey_attrs?
11:58Chouseryou can declare a namespace prefix association in any element, and it applies for that element and all descendants.
11:59Chouserthey look like attributes
11:59rhickey_are they not?
11:59rhickey_in a DOM?
12:00Chouser<ns1:foo xmlns:ns1="namespace1">...</ns1:foo>
12:00Chouserum... good question.
12:01rhickey_also most DOMs will present the tags as qualified names for programmatic use
12:01rhickey_or at least make the ns available
12:02rhickey_so a ns aware parser could ns-qualify while keywordizing...
12:03rhickey_and an emitter could elide anything namespaces declared along the way...
12:03rhickey_setting aside read/print veracity
12:03ChouserSAX lists namespace declarations as attrs, though other parsers do other things.
12:05Chouserxpath and xslt associate the real namespace with each tag and attr
12:05ChouserI'm not sure what the w3 DOM does
12:06rhickey_applying the namespaces on read seems to be the right thing
12:07rhickey_getting rid of them on the way out is the trick
12:08Chousersure. but even "apply the namespace" isn't obvious to me.
12:08ChouserOr I guess what I mean is, what's the canonical format?
12:08rhickey_:ns:name
12:09Chouserexcept an ns looks like http://www.w3.org/1999/xhtml
12:09Chouseryou don't want {:tag :http://www.w3.org/1999/xhtml:img ...}
12:10ChouserI guess you could do {:tag :img, :nsmap {nil "http://www.w3.org/1999/xhtml&quot;} ...}
12:10Chouser...and then have the nsmaps apply to children, just like raw xml does. But then those children lose meaning when taken out of context.
12:10Chouser(this is what I meant by "where to put the ns map")
12:11rhickey_if you don't end up with the ns on the tag somehow, everyone will have to track the namespaces, there isn't one map as it can change in nested contexts
12:12rhickey_if I see :img in the middle of the document, how do I know which :img?
12:12Chouserright. the same question applies to :xhtml:img -- which xhtml?
12:13Chouserin practice, most documents don't stack their nsmaps very much. you tend to declare them in the root element and leave them alone.
12:13rhickey_but programmatically you can ask img for its ns and get http://www.w3.org/1999/xhtml
12:13rhickey_anywhere, with no lookup table
12:13Chouserhow? I don't follow.
12:14ChouserI mean, we need to provide a way to do that, but I don't see how to best store that information.
12:14rhickey_when you load that into a dom and ask the element for its ns you get the whole gnarly thing
12:14rhickey_metadata, except none for keywords...
12:14Chouser:-)
12:15Chouserright, because remember each attr has a namespace as well
12:15rhickey_yes, all names
12:16Chouserit's also beneficial to store the prefixes used on input somewhere. there are a lot of almost-correct xml tools that panic when you use an unexpected prefix
12:17Chouserthey want <rss:entry xmlns:rss="...rss..."> not <n1:entry xmlns:n1="...rss...">
12:18rhickey_I don't think we'd be making up prefixes
12:18Chousermaybe it would work for every element to have an :nsmap, and mostly they would all be the same hash-map
12:18rhickey_maybe swapping in full qualifiers
12:19Chouserif you hit a stacking case on input, the subtree of elements will all be pointing to a second hash-map
12:19rhickey_something does that... some Scheme thing?
12:19cemerickI'm totally lurking here, and a long way from the days when I swam in XML, but it seems that conforming to XML Infoset would be a #1 priority. Syntax and such are definitely important, but the data model needs to be right...otherwise, impedance ramps up quickly when serializing, etc.
12:26rhickey_http://okmij.org/ftp/Scheme/SXML.html
12:29rhickey_emulated here: http://groups.google.com/group/clojure/browse_frm/thread/ce8131bd1ae59bfc/437c0119d2c91628?#437c0119d2c91628
12:32cemerickyeah, SXML looks like a good starting point.
12:33cemerickI only brought up infoset because it was what led me to sanity after running into some very hairy technicalities w.r.t. namespace handling in various contexts. There be dragons.
12:34cemerick(or, some degree of sanity; IIRC, there are some edge cases where some key XML specs are in conflict and/or ambiguous w.r.t. namespace handling)
12:37Chouserok, so sxml attempts to handle namespaces though that clojure version doesn't?
12:38cemerickChouser: yeah, that's listed as one of the to-do's in the code
12:38Chouserah, indeed.
12:39ChouserI don't really understand what sxml is doing, though.
12:39Chouser"If an application told the parser how to map http://www.cars.com/xml, the application can keep this mapping in its mind and will not need additional reminders."
12:41Chouserit seems to list details in an element's (@ ...) list, but it's not clear to me if that's actuallying being returned or not
12:41Chouserhuh. http://www.cars.com/xml:part is a valid scheme symbol.
12:47cemerickRich's sxml link was the first I've heard of it, but it seems that he's talking about application-registered namespaces.
12:48cemerickWhich can be handy in situations where you need to combine documents that have conflicting namespace aliases.
13:53rhickey_user=> (namespace 'http://www.cars.com/xml/part)
13:53rhickey_"http://www.cars.com/xml&quot;
13:55rhickey_user=> (name :http://www.cars.com/xml/part)
13:55rhickey_"part"
14:15cemerickrhickey_: shouldn't that be :http://www.cars.com/xml:part?
14:16rhickey_not in Clojure, namespace is everything before last /
14:16rhickey_this way you can get at the parts with namespace and name
14:17rhickey_on emit can be changed to :
14:20cemerickoh, I figured you were using some functions in some xml ns you were working on. Clever bit, reusing the built-ins.
14:21rhickey_still trying to encode xml in native data structures, here symbols or keywords for identifiers
14:23rhickey_when working with xml esp rdf, it is a huge pain when systems create a composite identifier with no ability to split ns and name
14:24cemerickyes, definitely
14:43Chouserrhickey_: do you think the whole universal name should be used for every tag and attr name in the internal structure?
14:44rhickey_Chouser: I don't know, but it's now an option
14:44Chouser:-) ok.
14:45rhickey_other options are to use symbols, with namespaces in the metadata (:ns ^(tag e))
14:46Chousersymbols are interned, but their metadata wouldn't be, is that correct?
14:47rhickey_one problem is that 'by hand' xml data would still need to be 'parsed' to get the qualification
14:47cemericksemantically, namespaces are definitely *not* metadata (at least how clojure conceives of metadata)
14:47rhickey_Chouser: if the names are symbols or keywords, the strings are interned, ns meta maps can be shared as you described before
14:47rhickey_cemerick: true
14:48rhickey_attrs could be considered metadata, but xml really leaves the semantics open
14:49cemerickI mean, clojure metadata is a thoroughly convenient mechanism for name metadata. FWIW, I often wish there were parallel metadata tracks in clojure -- one for the current notion of metadata, and one that *is* considered part of a value.
14:50cemerick(not that I don't abuse that mechanism for my own purposes, anyway ;-) )
14:51rhickey_cemerick: is considered for equality or something more?
14:56cemerickequality for sure, but other things too, I'm sure. Having that other metadata print (with pr, etc) would be super-handy.
14:57rhickey_*print-meta* controls meta printing
14:57cemerickI've got a prn-with-meta fn that gets the job done with the current metadata, so it's not a big deal.
14:57cemerickHah!
15:22StartsWithKhi
15:22StartsWithKso i was trying to create this osgi bundle with clojure
15:22StartsWithKand i have no luck
15:23StartsWithKwhatever i do i get that java.lang.ExceptionInitilizerError
15:24StartsWithKdid any one created osgi bundle with clojure?
15:25StartsWithKit seams that clojure can't find boot.clj, it throws same error if i remove boot.clj from clojure.jar and try to run in
15:26StartsWithKi don't know is this important but i use Knopflerfish as osgi container
15:27cemericksounds like a classloader issue
15:28StartsWithKyes it looks like it is
15:28StartsWithKso ill just dump all experiments i did so far
15:29StartsWithKincluded clojure.jar in my bundle.jar and used Bundle-ClassPath: clojure.jar
15:29StartsWithKincluded files from clojure.jar in my .jar
15:29StartsWithKadded Bundle-ClassPath: .
15:29StartsWithKand copied all .clj files from clojure.jar to directory where my .jar is located
15:30cemerickwell, I don't know how Bundle-Classpath works, but if you want to merge Clojure in with your jar, you need to put everything from clojure.jar into your jar
15:30cemerickthe .clj files, too
15:30StartsWithKi did that too
15:30StartsWithKsame thing
15:31cemerickOK, so your jar's top level has the clojure classfile dir, yes?
15:31StartsWithKyes
15:31cemerickthe .clj files should be at that top level as well
15:32StartsWithKther are
15:32StartsWithKthey*
15:32cemerickWell, it *should* work. :-) boot.clj is loaded using the same classloader that loaded clojure's core runtime class(es)
15:32StartsWithKhmm
15:32StartsWithKi wish it worked :)
15:33cemerickhrm, try putting the clj files in clojure/lang in your jar
15:34StartsWithKok
15:43StartsWithKsame thing happens
15:44StartsWithKat this point i have .clj in my jar, inside clojure/lang in my jar, clojure.jar in my jar and all .clj files in directory where my jar is located
15:44StartsWithKits not picking up on any of them
15:45StartsWithKalso, this code work outside of osgi container.. i can run it as standalone just fine
15:45cemerickwell, the last thing you mentioned wouldn't ever work. The 2nd and 3rd things should definitely work (modulo the operation of Bundle-Classpath
15:47StartsWithKill create minimal example, using java instead of scala.. but there should not be any difference there
15:51cemerickNevermind, the first option should be the one that works (I just re-noticed that '/' is prepended to all paths being loaded at init).
16:22StartsWithKhmm.. same thing
16:25StartsWithKif i run it again, without reintalling the bundle
16:25StartsWithKi get
16:26StartsWithKjava.lang.NoClassDefFoundError: Colud not initialize class cljure.lang.RT
16:46StartsWithK For the OSGi import/export mechanism to work,
16:46StartsWithK the bundle must use the Bundle classloader.
16:46StartsWithKo! However, many libraries uses the system
16:46StartsWithK classloader or the thread's classloader
16:46StartsWithK o! Works great in standalone apps
16:46StartsWithK o! Does not work at all in typical OSGi settings
16:47StartsWithKfrom knopflerfish presentation about bundling existing applications as osgi bundles
16:47StartsWithKand i see that DynamicClassLoader is using thread's
16:51cemerickStartsWithK: well, NoClassDefFoundError is much different than the initializer exception you mentioned earlier
16:56StartsWithKcemerick, yes it is, but that is from second call to bundle's start(), so if RT's static {} field faild to execute first time that could be why i see that message second time i try to start the bundle
17:08cemerickStartsWithK: could you paste a full stack trace?
17:08StartsWithKcemerick, here is no stack trace at all
17:09StartsWithKjust that one message that is shown inside knopflerfish admin gui
17:09StartsWithKi mean, there is stack trace but it starts with kf gui and only last entry is for my bundle
17:09cemerickhave you checked your log files? The stack trace must be printed out somewhere.
17:10cemerickYou might have to turn on osgi debugging, etc., in order to get the original stack trace
17:10cemerickThat is, if clojure.lang.RT is being found, but is causing an error during initialization.
17:13StartsWithKoh.. i didn't turn all debug options inside kf.. ill try with all of them on
17:24meredyddHmm..any suggestions for:
17:24meredyddjava.lang.Exception: Unable to resolve symbol: in this context
17:24meredyddDidn't think you could *have* an empty symbol :)
17:25meredydd(Just to be helpful, it's giving me no line numbers at all)
17:25meredydd(or even a file)
17:25Chousermeredydd: is this with the new easier-to-understand stack traces?
17:26rhickey_any more stack trace than that?
17:26meredyddChouser: Yep. It's a compiler thing, though, so it's probably not part of the rejig.
17:26meredyddrhickey_: Sure, one sec
17:27meredyddhttp://pastebin.com/m7b2cc513
17:28meredyddNice. Is this that XMPP library you're playing with?
17:28rhickey_yeah
17:28rhickey_I have a repl going through gtalk and jabber.org
17:29meredyddMuch less elegant, and less XMPP.
17:29meredyddAny enlightenment on the compiler error?
17:31rhickey_meredydd: sure looks like you have a blank symbol somewhere
17:31meredyddThe mind boggles. How *does* one write a blank symbol?
17:31rhickey_any symbol-creating macros in there?
17:32meredyddUhh...doing what?
17:32meredyddI have one or two that use #
17:32Chousermeredydd: You have to delete the line where you do: (symbol "")
17:32meredyddand I think the odd (gensym), before I found out about #
17:32rhickey_(symbol "") or equivalent
17:32Chouser;-)
17:32meredyddOh. No.
17:33meredyddHmm. I *am*, however, using 'lib
17:33meredyddwhich probably does do some interesting symbol-bending behind the scenes
17:36meredydd...and it appears to have gone away again. Which is odd.
17:37meredyddI was *sure* I'd restarted the REPL after the update to svn HEAD. Perhaps my mind is playing tricks on me.
17:38rhickey_meredydd: I put up a patch which wraps the body of analyze, so you should get a line next time
17:38meredyddThank-you.
17:38meredyddDo I get a filename as well?
17:38rhickey_yup
17:38meredyddta
17:41rhickey_now I can write a coy "Little Clojurer" book with the code in iChat bubbles
17:41meredyddSomeone's having fun :)
17:43StartsWithKcemerick, http://pastebin.com/m560b7301
17:43StartsWithKthis is with copy of clojure inside my jar, .clj files are both in root of my jar and in clojure/lang
17:45StartsWithKthats it, no error message inisde debug log, only in kfish popup window
17:45meredyddrhickey_: Would it be possible, when method invocations go via reflections, to wrap the method call in a try-catch block for InvocationTargetException and re-throw the original (causal) exception?
17:46rhickey_no, but it could be peeled off in the repl
17:46meredyddThe causal exception has the full backtrace any Clojure programmer is looking for - from our PoV, the InvocationTargetException amounts to an implementation detail
17:47meredyddIs there a particular reason you're not willing to peel off InvocationTargetExceptions in all cases? (I'm guessing it's going to be a performance thing)
17:48rhickey_and code gen size
17:50meredyddHmm...theoretically, one might move reflected calls into RT, but I guess that's an extra-stack-frame penalty you don't want either
17:50meredyddI have no intuitive feel for how slow reflection is, so I don't really know how much it would cost in relative terms.
17:52rhickey_I take all that back, the calls go through Reflector so I can just change that rather than each gen point...
18:02rhickey_meredydd: done - so no error reporting complaining for 1 week :)
18:03meredyddYay!
18:03meredydd(although if you want me to stop yelping when I stub my toe on something in the language, I fear a +b might be the only effective approach.)
18:04rhickey_just kidding, I like improving Clojure
18:04meredyddIn all seriousness, though, from what I've seen, your stack-tidying, and now this together, look like the silver bullet.
18:05meredyddMy stack traces actually tell me where in my code I was when I screwed up, and do so fairly concisely.
18:06rhickey_I'll grant completely that my first priority was making correct code work correctly, error handling will improve with time, but dynamic langs always have some more room for errors
18:08meredyddAbsolutely, I agree with the emphasis. But I was having to grovel through three-deep stacks of InvocationTargetExceptions, checking the trace at each level to see whether my filename was there at all
18:08meredyddwhich got a bit wearing after a while.
18:08meredyddBut no longer!
18:37mebaran151I'm playing with Clojure and I was wondering if there was an easy way to declare a main method so I could easily launch my app from the Netbeans idea
18:39mebaran151also are there any good ideas as to how write servlets with clojure: should I just define one generic servlet and route everything through it, hitting associated functions?
18:47mebaran151eerie silence ...
19:17cemerickmebaran151: There's no main methods per se -- use clojure.lang.Script to bootstrap a .clj file whose top-level forms do what you'd want from a "main method"
19:18cemerickStartsWithK: I don't see any errors there -- looks like the BundleClassLoader (whatever that is) is finding everything, including .clj files
19:18StartsWithKcemerick, yes, it looks like that
19:19StartsWithKbut i am not even trying to execute any code from my test
19:19StartsWithKonly call RT.nextID()
19:19cemerickAnd the UI shows an exception?
19:19StartsWithKyes
19:20StartsWithKmaybe i should try with alternative osgi container
19:20cemerickI don't know. Try deploying a java-only (no clojure) app to knopflerfish, where all it does is try to load a file from the jar you deploy (i.e. using class.getResourceAsStream)
19:20cemerickor, yes, try another container
19:21cemerickI know people are using clojure within eclipse, which I think uses osgi pretty pervasively
19:21StartsWithKusing clojure to write eclipse plugins?
19:22cemerickthat I'm not aware of, but I'm pretty sure eclipse uses osgi "stuff" to bootstrap apps when debugging, etc
19:22StartsWithKmy other option is equinox
19:22cemerick(so as to support "hot" code reloading, etc)
19:22StartsWithKyes, they have equinox as there osgi implementation
19:22cemerickotherwise, try to find out from the knopflerfish folks how to get the details of that stack trace, because it's not showing anywhere in the logs
19:23StartsWithKits second day i am trying to use kfish.. and not impressed in general
19:24cemerickwell, if eclipse is using equinox, then it seems like a safe choice
19:24StartsWithKgui starts in 2-3 mnues before i can even see bundles..
19:24StartsWithKwell, thats it for today
19:25StartsWithKthanks for help.. ill continut this tomorow
19:25cemerickStartsWithK: np
19:29mebaran151cemerick: is that a Java class or something?
19:33cemerickmebaran151: Yes, clojure.lang.Script is a Java class
19:33cemerickmebaran151: for example, java -cp clojure.jar clojure.lang.Script yourfile.clj will load yourfile.clj and exit
19:34mebaran151ah so it should just be in the startup script
19:35mebaran151I'm trying to figure out how to get Clojure integrated into my servlet workflow too, so any pointers on that would be appreciated. Right now, I'm thinking of building a generic routing servlet that would dispatch to function matched in a hashmap. Is this the cleanest way to work with servlets in clojure?
19:36mebaran151the only problem with it being scripted that way is that I can't set netbeans just to run my app...
19:40cemerickmebaran151: that certainly sounds like the simplest way to do it. I'm not really a web programmer, though.
19:41cemerickwell, you'll want to gen-class your actual servlet, and then put the implementation of the servlet in clojure, and deploy the whole thing to tomcat, etc. Netbeans should be able to load that up without a problem.
19:42cemerickyou'll want to read this: http://clojure.org/api#gen-and-save-class
19:42cemerickg'night all
20:32mebaran151how do I set up the path in which closure searches for other namespaces
20:32mebaran151to import functions from
20:41mebaran151anyway to setup some sort of env file for a project so that aquamacs automagically picks up the libs I dump in lib and the cljs I keep in src
20:44ChouserYou can use load-file to load a .clj file, and then refer so you don't have to use a full namespace each time you call a function from that .clj
20:44rhickeymebaran151: there might be something in contrib, right now Clojure proper just has explicit load-file. user.clj will get auto-loaded, and you could put some logic in there to load all the cljs from a directory. As far as 'libs', are you talking about jars?
20:45mebaran151I need to use a couple jars from jetty
20:45mebaran151so load-file is probably somewhat similar to ruby's require semantics?
20:46rhickeymebaran151: no, but there is require in the lib.clj from contrib
20:47rhickeyjars are subject to Java classpath, which unfortunately doesn't let you put a dir in the classpath and jars in the dir - each jar must be in the classpath
20:49rhickeyClojure has add-classpath, but that should only be used temporarily to grab a jar you forgot - there are limits to the visibility of classes loaded that way
20:49mebaran151ah I see
20:49mebaran151what's contrib
20:49mebaran151I just started playing with Clojure today when I got sick of Scala's oh so mutable data structures
20:51rhickeycontrib is an incubation project for extensions to Clojure, some nice things there: https://sourceforge.net/projects/clojure-contrib/
20:56mebaran151what does the clojure/refer clojure mean?
20:57mebaran151thanks for all your help by the way: doc on closure is much to scattered....
20:57rhickeymebaran151: everything is covered on the API page in one place if you haven't seen that yet
21:00rhickeyrefer is the way you pull names into your namespace. A new namespace doesn't even have Clojure's public vars yet, so the use of refer itself has to be namespace qualified. (clojure/refer 'clojure) pulls in the core clojure names, after which refer, e.g., can be used without qualifier
21:00mebaran151oh I see
21:02arbschtspeaking of the api, have you considered hyperlinking each entry in the api to the reference page it is also described in?
21:02koneillmebaran151: if git is your poison there is a clone of the contrib project available from git://github.com/kevinoneill/clojure-contrib.git
21:03mebaran151so how would I include it? just dump it in lib and set up my user.clj to figure it out?
21:05rhickeyarbscht: at some point the redundancy between the two will be removed, so there won't necessarily be a place in the reference for each fn. There aren't already for many. I will try to go the other way as fns are referenced.
21:06mebaran151btw, does anybody here work with the Netbeans plugin? Can it reference the code in the buffer I'm working on?
21:07rhickeymebaran151: I haven't used the lib stuff, but I imagine if you have user.clj explicitly load lib.clj, then you can use its require to get classpath-based logical-name loading from there