[armedbear-devel] MQTT example using ABCL and Eclipse Paho
Alessio Stalla
alessiostalla at gmail.com
Mon Jun 24 17:07:33 UTC 2013
On Mon, Jun 24, 2013 at 4:50 PM, Frederico Munoz <fsmunoz at gmail.com> wrote:
> Hi all,
>
> I have written a simple example of using the Eclipse Paho libraries, via
> ABCL, to send messages in Common Lisp using MQTT. I will not write much
> more here since it's in the article which contains the code and some
> other considerations: http://finisterra.motd.org/?p=237
>
> As I note I initially did this in Clojure so - and just like my
> experiments with Swing before which I sent to the list as well - this is
> in a way a comparison on how the interop facilities work. My code is not
> exactly stellar (either the Clojure or the CL one) but it is, I hope,
> easy enough to understand and follow, especially since I couldn't found
> any other example out there, which is why I thought the list could have
> some use for it (even if only for future reference).
Hi! This is very interesting - both the "how to use Eclipse Paho in
Lisp" part, and the comparison with Clojure. Thanks for sharing!
> I stumbled a bit on getting the command-line arguments but that was due
> to my custom-made abcl script end with $@ instead of "@" - something to
> watch for :)
>
> I had one problem that I found weird and which I would welcome any help,
> I'm not sure why the following works:
>
> CL-USER(3): (#"currentThread" 'Thread)
> #<java.lang.Thread Thread[interpreter,5,main] {BD30B16}>
>
> ... but the following doesn't:
>
> 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.
> For another short demo I have I will need to subclass, something used in
> Swing programming a lot from what I could understand. If I'm not
> mistaken this isn't currently supported in ABCL, but I will read on it.
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.
Cheers,
Alessio
>
> Best regards,
>
> Frederico
>
>
--
Some gratuitous spam:
http://ripple.com Ripple, social credit system
http://common-lisp.net/project/armedbear ABCL, Common Lisp on the JVM
http://code.google.com/p/tapulli my Lisp open source projects
http://www.manydesigns.com/ ManyDesigns Portofino, open source
model-driven Java web application framework
More information about the armedbear-devel
mailing list