2008-07-27
| 07:54 | hoeck | is it possible to query a clojure fn about the number of arguments it expects? |
| 08:01 | hoeck | ahh, yes it is, thanks to reflection! |
| 14:59 | Chouser | I know absolutely nothing about this, so I really am asking -- why is the clojure namespace not org.clojure.lang, etc.? |
| 15:37 | rhickey | Chouser: for the same reason that java.lang is not org.java.lang (i.e. no good reason) |
| 15:44 | Chouser | heh |
| 15:44 | Chouser | ok |
| 15:45 | Chouser | I see this line near the top of PHM.java: new EmptyNode() |
| 15:46 | Chouser | But when I do: (clojure.lang.PersistentHashMap$EmptyNode.) I get No matching ctor found |
| 15:46 | Chouser | what am I missing |
| 16:01 | hoeck | Chouser: i guess the inner class EmptyNode is not public |
| 16:02 | Chouser | ah, ok. thanks. Shows just how little Java I know, I guess. :-/ |
| 16:05 | hoeck | i'm used to the openess of clojure too, but i had the "no matching ctor found" exception quite often and now my eyes are trained to recognize the missing `public' :) |
| 16:12 | Chouser | seeing something that isn't there is a pretty impressive skill. |
| 16:31 | joekarma[lunch] | I see dead people |
| 20:34 | Chouser | rhickey: trying to use :exposes is failing for me, and indeed getField returns nil. But getDeclaredField seems to return the desired result. |
| 20:34 | Chouser | This is stock gen-class, testing on javax.swing.DefaultCellEditor's clickCountToStart field. |
| 20:35 | Chouser | (.getField (identity javax.swing.DefaultCellEditor) "clickCountToStart") |
| 20:51 | Chouser | from the Java docs it looks like getField only finds public fields, not protected ones like :exposes is looking for. |
| 21:02 | rhickey | Chouser: ok, do you have a fix you want me to add? |
| 21:02 | Chouser | I think so, but my test cases are pretty thin. |
| 21:03 | Chouser | I'll post what I've got later tonight, tests and all. |
| 21:03 | rhickey | isa-based multimethods and a la carte hierarchies are up! |
| 21:04 | Chouser | nice. |
| 21:04 | Chouser | you have the 15 pages of docs and examples up too, right? ;-) |
| 21:04 | Chouser | docs are such a drag. |
| 21:05 | rhickey | all the functions are doc'ed, writing up a message to the group now |
| 21:05 | rhickey | also added resolving keywords - ::foo reads as :current-ns/foo |
| 21:06 | Chouser | interesting. |
| 21:08 | rhickey | keywords make better tags, since they print/read as themselves, but ` doesn't add namespaces to keywords that don't have them |
| 21:08 | rhickey | but namespaces are important (required in fact) for tag hierarchies |
| 21:09 | Chouser | I used :xml-filter/something-or-other and felt odd about it. this'll be nice. |
| 21:20 | Chouser | Actually, I probably should merge these two changes. If you want to replace line 415 of genclass.clj, it will fix my one test case: |
| 21:20 | Chouser | I probably should *not* merge these two changes. |
| 21:20 | Chouser | (let [fld (.getDeclaredField super (str f)) |
| 21:24 | rhickey | Chouser: line 413? |
| 21:25 | Chouser | oh, probably. sorry, I've other changes in that file. just replace .getField with .getDeclaredField. |
| 21:26 | rhickey | ok, it's up |
| 21:27 | Chouser | fantastic -- works for me, now. |
| 21:36 | Chouser | ok, I just posted my tiny gen-class patch and test. biab. |
| 21:37 | lisppaste8 | rhickey pasted "isa? hierarchies" at http://paste.lisp.org/display/64336 |
| 22:17 | rhickey | Enhanced multimethods explained: http://groups.google.com/group/clojure/browse_frm/thread/9cc9926de1bdb128 |