[armedbear-devel] Simpe swing examples using JSS and JFLI

Alan Ruttenberg alanruttenberg at gmail.com
Wed Aug 1 14:43:48 UTC 2012


Hi,

As an addition to the discussion, see
http://paste.lisp.org/display/130806in which I define a macro that
behaves like doto for this example. Note
that the JSS lisp paste had a typo - s/setsize/setSize/

This addresses your point 5 - macros are always possible ;-)

The main reason that I didn't use the dot notation for jss was that I don't
want to live with a case sensitive reader all the time. OTOH if someone
wants to offer up a readtable that reads case-sensitive at the right times
(like after the "." for a symbol in the function position), that might be
interesting to try.

Note that #"foo" reads as funcallable function - e.g. you can write

(funcall #"foo" arg1 arg2...)

Are the dot functions also regular functions in closure, or are they
special forms?

-Alan

On Fri, Jul 20, 2012 at 10:22 AM, Frederico Muñoz <fsmunoz at gmail.com> wrote:

> Greetings,
>
> I've been playing around with ABCL for some days now, especially in
> terms of the Java interop abilities and Swing. This is because I was
> searching for a Lisp that could be easily used for cross-platform GUI
> programming and easy deployed (for the user). This narrowed it down to
> the several JVM-based Lisps (ABCL, Kawa, etc) and Clojure.
>
> While I like Clojure - and "lein uberjar" is a great facility, for
> example - I'm more confortable in CL, so I did this two small examples
> that can perhaps be useful as a way to compare ABCL's different interop
> facilities with themselves and Clojure. In a way I used this to get a
> "feel" on how things would work out and make a decision.
>
>  ABCL JSS Swing Example:   http://paste.lisp.org/display/130606
>  ABCL JFLI Swing Example:  http://paste.lisp.org/display/130605
>
> I'm going to make another use using the lower-level API (jcall, etc),
> for the sake of completeness, but I think that perhaps this examples can
> be helpful to others as a small reference, using a well-known
> example. For me it was quite fun and my overall impressions thus far is
> that:
>
>  1) ABCL offers different interop facilities that taken as a whole make
> it a quite capable solution for overall Java interop, including GUI
> programming.
>
>  2) The JSS approach has the advantage of being less verbose since the
> methods need not contain the class name (which looks cleaner IMO). It is
> also simpler to setup, i.e. no need for def-java-class et. al.
>
>  3) The JFLI approach integrates well with Lisp, since it provides
> completion of methods, amongst other small things. The lack of #"foo"
> syntax is also visually appealing IMO. It can also - theoretically - be
> used by JFLI installations in other Lisps. It is more verbose though,
> since methods must be preceeded with the class (class.foomethod)
>
>  4) Clojure's approach is (naturally) conceptually quite similar to
> JFLI, in the "feel" that it provides, although the use of (.fooMethod
> instance) is similar to (#"fooMethod" instance) in terms of synxtax. The
> use of macros (like doto) significantly reduces number of words used.
>
>  5) I see nothing in the way of implementing similar macro mechanisms on
> top of either JSS or JFLI - but I can be simplifying things brutally
> here.
>
> In the most simple scenario syntax differences are as follows:
>
>  ABCL JSS:     (#"setText" my-label "The Larch")
>  ABCL JFLI:    (jlabel.settext my-label "The Larch")
>  Clojure:      (.setText my-label "The Larch")
>
> The Clojure approach seems quite similar to the javadot approach of
> jscheme (http://jscheme.sourceforge.net/jscheme/doc/javadot.html), as
> noted in the ABCL blog - I was unaware of that.
>
> More complex approachs envolving the need for proxies contain more
> differences of course.
>
> I would greatly welcome any comments concerning style and approach: I am
> completely new to this so I am probably missing a lot. It was quite
> enjoyable though, even if there are still some rough edges here and
> there (quite understandable since for JFLI I had to used trunk). I think
> that this is an area worth exploration, easy (meaning well-integrated,
> clear syntax, small impact) interop is a huge advantage.
>
> Thank you for your hard work, highly appreciated.
>
> Cheers,
>
> Frederico
>
> _______________________________________________
> armedbear-devel mailing list
> armedbear-devel at common-lisp.net
> http://lists.common-lisp.net/cgi-bin/mailman/listinfo/armedbear-devel
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/armedbear-devel/attachments/20120801/cbae04cc/attachment.html>


More information about the armedbear-devel mailing list