Hi,
Alessio Stalla alessiostalla@gmail.com writes:
Hi! This is very interesting - both the "how to use Eclipse Paho in Lisp" part, and the comparison with Clojure. Thanks for sharing!
You're too kind, thank you. I'm glad you found it worthwhile, my idea is to share practical tidbits, even if code-wise they are hardly very elegant.
CL-USER(4): (#"sleep" 'Thread 100) #<THREAD "interpreter" {19AA4D78}>: Debugger invoked on condition of type ERROR no such method Restarts: 0: TOP-LEVEL Return to top level.
I think this is because Thread.sleep takes an argument of type long, while 100 is an int, and ABCL isn't smart enough to search for applicable methods taking type conversions into account.
That was exactly my idea, which is why I tried: (#"sleep" 'Thread (coerce 100 'long-float)), but now that you mention it I went looking around and found jcoerce, which seems like a way to do it without relying on any smartness. That being said it doesn't seem to work:
(java::jcoerce 100 "java.lang.Long") => The value 100 is not of type "java.lang.Long". [Condition of type TYPE-ERROR]
I found this link that points towards some conversion not being implemented (http://lists.common-lisp.net/pipermail/armedbear-devel/2012-July/002481.html), so perhaps this is not doable right now.
Creating Java classes in Lisp (known as "runtime-class" for historical reasons in ABCL) is a partially implemented feature at the moment, and documented quite messily (see http://lisp.not.org/trac/armedbear/wiki/JavaFfi/RuntimeClass; it is more of an idea dump than a proper reference). The key missing functionality is calling superclass constructors, which renders it not useful in a lot of cases. I worked on it a bit a while ago; if you're interested, I might start working on it again a bit - adding constructors is not a lot of work.
Yes, thank you, I remember you referring to this some months ago when I wrote about the Swing examples. I'll take a look and perhaps present a very simple use-case and why it does or doesn't work, just to identify specific implementation improvements.
Best regards,
Frederico