<?xml version="1.0" encoding="utf-8" ?>

<rss version="2.0" 
   xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
   xmlns:admin="http://webns.net/mvcb/"
   xmlns:dc="http://purl.org/dc/elements/1.1/"
   xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
   xmlns:wfw="http://wellformedweb.org/CommentAPI/"
   xmlns:content="http://purl.org/rss/1.0/modules/content/"
   xmlns:creativeCommons="http://backend.userland.com/creativeCommonsRssModule">
<channel>
    <title>SIGKILL - Programming</title>
    <link>http://sigkill.dk/blog/</link>
    <description>Hello, World!</description>
    <dc:language>en</dc:language>
    <generator>Serendipity 1.5.2 - http://www.s9y.org/</generator>
    <managingEditor>athas@sigkill.dk</managingEditor>
<webMaster>athas@sigkill.dk</webMaster>

    <image>
        <url>http://sigkill.dk/blog/templates/default/img/s9y_banner_small.png</url>
        <title>RSS: SIGKILL - Programming - Hello, World!</title>
        <link>http://sigkill.dk/blog/</link>
        <width>100</width>
        <height>21</height>
    </image>

<item>
    <title>#:els:2008</title>
    <link>http://sigkill.dk/blog/archives/306-els2008.html</link>
            <category>Lisp (EN)</category>
    
    <comments>http://sigkill.dk/blog/archives/306-els2008.html#comments</comments>
    <wfw:comment>http://sigkill.dk/blog/wfwcomment.php?cid=306</wfw:comment>

    <slash:comments>2</slash:comments>
    <wfw:commentRss>http://sigkill.dk/blog/rss.php?version=2.0&amp;type=comments&amp;cid=306</wfw:commentRss>
    

    <author>nospam@example.com (Troels Henriksen)</author>
    <content:encoded>
    &lt;p&gt; I have just returned home from the European Lisp Symposium
of 2008, held in Bordeaux, and I shall now inflict upon you my
experiences from the event. &lt;/p&gt;

&lt;p&gt; I&#039;m not a very experienced traveller - indeed, this was my first
time travelling by plane by myself, so I was slightly worried about
getting lost along the way from Copenhagen to Bordeaux. My trip was
fairly uneventful, though I was a bit mystified by travelling via a
KLM-owned &lt;a href=&quot;http://en.wikipedia.org/wiki/Fokker_F100&quot;&gt;Fokker
100&lt;/a&gt;, a plane manufactured by a company that left the business
quite a while ago. I was not less mystified when the rest of the
flight was done in a plane that the safety guide claimed was a &lt;a
href=&quot;http://en.wikipedia.org/wiki/Fokker_50&quot;&gt;Fokker 50&lt;/a&gt;, but which
most assuredly did not have turboprop engines.&lt;/p&gt;

&lt;p&gt;For my part, the stereotype about French people not understanding
English turned out to be fairly true. Even more, the tram ticket
machine did not understand English either, the clearly labelled button
for changing the interface language seemed totally nonfunctional, as
if it was literally just painted on the machine. I was told that the
attitude towards English had changed in France - I can only imagine it
has changed from open disdain to a feeling of irrelevance.&lt;/p&gt;

&lt;p&gt; Anyway, on to the interesting part: the actual symposium, which
spanned over two days. The first day contained confusingly named
&quot;Birds of a feather&quot; sessions (also known as workshops/discussion
sessions). They were quite interesting, though I admit I had too
little interest in parallel programming to be that aware during the
first session. The CLIM/&lt;a
href=&quot;http://common-lisp.net/project/mcclim&quot;&gt; McCLIM&lt;/a&gt; session was
interesting, though my own part in it was pretty much a disaster due
to my SBCL session getting totally messed up in some way. Scott McKay
(the original designer of CLIM) managed to inject some interesting
comments though. Amusingly enough, it did not seem like he had the
same vision for CLIM as I have now, and rather took great pride in how
the spiritual successor (&lt;a
href=&quot;http://wiki.opendylan.org/wiki/view.dsp?title=DUIM&quot;&gt;DUIM&lt;/a&gt; for
Dylan) could perfectly resemble a mainstream, native user
interface. The informal session about the eventual successor to ASDF
was perhaps the most interesting, some actual and involved discussion
ensued and &lt;a href=&quot;http://random-state.net/&quot;&gt;Nikodemus&lt;/a&gt; came up
with the idea for a clever/horrible reader macro that inspired the
title of this blog post. It seems like the ASDF successor will be
motivated by two main things: facilitating a sane ASDF-Install
replacement and elegantly handling weird compilation options. Exactly
what I need, so I won&#039;t complain. I may even contribute code if it
comes to that.&lt;/p&gt;

&lt;p&gt; The presentations were decent, but I found that I learnt more
interesting stuff by talking with the authors than by listening to
their talks, so I&#039;ll elegantly skip to perhaps the most important
thing about the meeting: talking to other Lisp programmers in real
life and finally meeting people I&#039;ve talked to online for years. It
was very educative and entertaining; from listening to Scott McKays
view on CLIM, to discussing more general programming with Christophe
Rhodes and Robert Strandh, to getting a primer on Finnish politics by
Nikodemus Siivola. I obviously can&#039;t give a comprehensive description
of every topic touched by these conversations, but I can encourage
anyone who has never been to one of these events to attend the next
possible one, since actually talking face to face allows some
discussions to work much smoother than they do online. &lt;/p&gt;

&lt;p&gt; Unless practical problems get in the way, I&#039;ll definitely be
attending the next European Lisp Symposium. It was certainly a very
rewarding investment of my time.  &lt;/p&gt;
 
    </content:encoded>

    <pubDate>Sat, 24 May 2008 23:02:51 +0200</pubDate>
    <guid isPermaLink="false">http://sigkill.dk/blog/archives/306-guid.html</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by-sa/2.5/</creativeCommons:license>
</item>
<item>
    <title>McCLIM 0.9.6, day of the lizardslayer</title>
    <link>http://sigkill.dk/blog/archives/304-McCLIM-0.9.6,-day-of-the-lizardslayer.html</link>
            <category>Lisp (EN)</category>
    
    <comments>http://sigkill.dk/blog/archives/304-McCLIM-0.9.6,-day-of-the-lizardslayer.html#comments</comments>
    <wfw:comment>http://sigkill.dk/blog/wfwcomment.php?cid=304</wfw:comment>

    <slash:comments>1</slash:comments>
    <wfw:commentRss>http://sigkill.dk/blog/rss.php?version=2.0&amp;type=comments&amp;cid=304</wfw:commentRss>
    

    <author>nospam@example.com (Troels Henriksen)</author>
    <content:encoded>
    &lt;p&gt; McCLIM 0.9.6 &quot;St. George&#039;s day&quot; has just been released (Andy
Hefners suggestion of &quot;Discovery of the AIDS virus day&quot; was not used),
with quite a number of features. It&#039;s been over half a year since the
last release (which is unfortunately pretty typical for McCLIM), so
here&#039;s a list of the major improvements: &lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt; &lt;em&gt;Runs on SBCL:&lt;/em&gt; shortly after the McCLIM 0.9.5 release,
  the SBCL hackers cruelly removed an unexported, internal symbol that
  we relied on for some reason, preventing McCLIm 0.9.5 from running
  on anything but an oldish SBCL. ASDF-Installable McCLIM should
  therefore now run on SBCL again!&lt;/li&gt;

  &lt;li&gt;&lt;em&gt;Functions &lt;code&gt;make-pattern-from-bitmap-file&lt;/code&gt; and
  &lt;code&gt;read-bitmap-file&lt;/code&gt; added.&lt;/em&gt; These are from CLIM 2.2 and
  permit relatively simple reading of various bitmap image formats
  (currently supporting JPEG, GIF and XPM).&lt;/li&gt;

  &lt;li&gt;&lt;em&gt;Editor redisplay is much faster:&lt;/em&gt; I &lt;a
  href=&quot;http://sigkill.dk/blog/archives/297-I-can-put-what-in-my-buffer.html&quot;&gt;wrote
  a new redisplay engine&lt;/a&gt; for the Drei editor substrate a while
  back, it has &lt;em&gt;vastly&lt;/em&gt; better performance and a few extra
  features. It also improves &lt;a
  href=&quot;http://common-lisp.net/project/climacs/&quot;&gt;Climacs&lt;/a&gt; a
  lot.&lt;/li&gt;

  &lt;li&gt;&lt;em&gt;Fully in-Lisp Truetype font rendering.&lt;/em&gt; McCLIM has used
  an FFI to access &lt;a href=&quot;http://www.freetype.org/&quot;&gt;Freetype&lt;/a&gt; for
  a while, but Andy Hefner implemented a Truetype renderer in Common
  Lisp, meaning that McCLIM applications can now have pretty fonts
  without having to degrade themselves by asking C for help. Load the
  &lt;code&gt;mcclim-truetype&lt;/code&gt; system (as opposed to
  &lt;code&gt;mcclim-freetype&lt;/code&gt;) to activate it.&lt;/li&gt;

  &lt;li&gt;&lt;em&gt;Tons of bugfixes.&lt;/em&gt; As usual, this new release is the
  most stable McCLIM release ever! A lot of annoyances have been
  fixed, so McCLIM should now behave more predictably, though there is
  still some way to go before we reach perfection.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt; To celebrate this release, I hacked together &lt;a
href=&quot;http://sigkill.dk/code/tortoise.lisp&quot;&gt;a simple Logo
interpreter&lt;/a&gt;. The cool thing about this interpreter is that it
abuses &lt;code&gt;accept-from-string&lt;/code&gt; to implement a pseudo-Logo
programming language. A program can look like this: &lt;/p&gt;

&lt;pre&gt;
Pen Up
Lock
To &quot;Draw Left Half-Circle&quot;
Repeat 18
Forward 10
Left 10
Next
End
To &quot;Draw Circle&quot;
Invoke &quot;Draw Left Half-Circle&quot;
Invoke &quot;Draw Left Half-Circle&quot;
End
Unlock 
Pen Down
Center
Repeat 36
Invoke &quot;Draw Circle&quot;
Forward 20
Next
&lt;/pre&gt;

&lt;p&gt; I&#039;m not going to tell you what the output looks like, instead you
can download McCLIM 0.9.6, load &lt;a
href=&quot;http://sigkill.dk/code/tortoise.lisp&quot;&gt;tortoise.lisp&lt;/a&gt; and use
&lt;code&gt;Load Commands&lt;/code&gt; to load a file containing the above program
(or just enter it manually, if you want) and try it yourself! &lt;/p&gt; 
    </content:encoded>

    <pubDate>Wed, 23 Apr 2008 14:14:45 +0200</pubDate>
    <guid isPermaLink="false">http://sigkill.dk/blog/archives/304-guid.html</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by-sa/2.5/</creativeCommons:license>
</item>
<item>
    <title>Unusual method combinations are your friend!</title>
    <link>http://sigkill.dk/blog/archives/299-Unusual-method-combinations-are-your-friend!.html</link>
            <category>Lisp (EN)</category>
    
    <comments>http://sigkill.dk/blog/archives/299-Unusual-method-combinations-are-your-friend!.html#comments</comments>
    <wfw:comment>http://sigkill.dk/blog/wfwcomment.php?cid=299</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://sigkill.dk/blog/rss.php?version=2.0&amp;type=comments&amp;cid=299</wfw:commentRss>
    

    <author>nospam@example.com (Troels Henriksen)</author>
    <content:encoded>
    &lt;p&gt; Method combinations are one of the really cool, yet often
overlooked, parts of CLOS. They allow you to elegantly and succinctly
specify protocols that would otherwise require wrapper functions, ugly
calls to &lt;code&gt;call-next-method&lt;/code&gt; and a fair amount of similar
logic in every defined method. Take for instance &lt;a
href=&quot;http://common-lisp.net/project/climacs/&quot;&gt;Climacs&lt;/a&gt;, where we
have to generate a list of the available commands. This list depends
on many things, in particular the current view, syntax and active
modes, and so methods must be defined for all these. This practically
screams for an &lt;code&gt;append&lt;/code&gt; method combination, wherein every
part of an object (that is, all subclasses) get a chance to add their
own contribution to the resulting list, without any method having to
implement any kind of list-appending logic. Without method
combinations, this would have required explicit calls to
&lt;code&gt;append&lt;/code&gt; and &lt;code&gt;call-next-method&lt;/code&gt;; rote code that
is not essential to the purpose of producing a list of applicable
commands. CLOS permits me to write methods that are solely focused on
the actual task they are supposed to do, while the system takes care
of the tedious task of assembling the various results into the final
value. It also makes it trivial to add further methods later, as they
are automatically picked up by the method combination. And compared to
use of &lt;code&gt;call-next-method&lt;/code&gt;, I don&#039;t have to worry about
whether there is a next-method, CLOS takes care of that for me.&lt;/p&gt;

&lt;p&gt; This kind of functionality is, I think, what makes Lisp a powerful
language. Many other languages have syntactical shortcuts and
convenient functions for everything, enabling very short programs that
do interesting things (Ruby is particularly good at this). Common Lisp
is not well suited for one-liners and very short programs, the syntax
and provided facilities are usually too general. On the other hand,
Common Lisp shows its power once the program grows - the language
facilities are well suited for splitting up complex code and defining
small ad-hoc frameworks (like generic functions with unusual method
combinations) that would require a fair bit of code in other
languages. Thus, I believe that while Common Lisp may look overly
verbose for short programs, it makes it possible to implement long
programs in a smaller amount of code than it would take in many other
languages, and the resulting code can be flexible and extensible, even
for complex problems.&lt;/p&gt;
 
    </content:encoded>

    <pubDate>Tue, 29 Jan 2008 12:33:06 +0100</pubDate>
    <guid isPermaLink="false">http://sigkill.dk/blog/archives/299-guid.html</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by-sa/2.5/</creativeCommons:license>
</item>
<item>
    <title>A uniform macro for converting objects to other types</title>
    <link>http://sigkill.dk/blog/archives/298-A-uniform-macro-for-converting-objects-to-other-types.html</link>
            <category>Lisp (EN)</category>
    
    <comments>http://sigkill.dk/blog/archives/298-A-uniform-macro-for-converting-objects-to-other-types.html#comments</comments>
    <wfw:comment>http://sigkill.dk/blog/wfwcomment.php?cid=298</wfw:comment>

    <slash:comments>1</slash:comments>
    <wfw:commentRss>http://sigkill.dk/blog/rss.php?version=2.0&amp;type=comments&amp;cid=298</wfw:commentRss>
    

    <author>nospam@example.com (Troels Henriksen)</author>
    <content:encoded>
    &lt;p&gt; A few days ago, the great topic of #lisp was type conversion
functions, and in particular the notation that should be used for
them. Some advocated &lt;code&gt;fromtype-to-totype&lt;/code&gt;, others
&lt;code&gt;totype-from-fromtype&lt;/code&gt;, and of course perhaps the most common
notation, &lt;code&gt;fromtype-&amp;gt;totype&lt;/code&gt;. I declared that I preferred a
variant of the latter, namely &lt;code&gt;totype&amp;lt;-fromtype&lt;/code&gt;, due to the
fact that this permits clean and readable nesting, but &lt;a
href=&quot;http://www.cliki.net/Nikodemus%20Siivola&quot;&gt;Nikodemus&lt;/a&gt; of SBCL
fame pointed out that this could be turned into a more general &lt;code&gt;(&amp;lt;-
(totype middletype fromtype) object)&lt;/code&gt;-facility. And he was right,
the Power of Lisp macros, as commonly pointed out by the sublime Paul
Graham, permits all sorts of notational conveniences. I therefore set
out to write the most intuitive and clear general type conversion
facility I could think of, so that the current common practise of
writing Lisp programs as large type transformations will yield more
readable and consistent programs in the future.&lt;/p&gt;

&lt;p&gt; As my focus was on ease-of-use, an intuitive interface and
predictable semantics, I decided that the overall pattern of
&lt;code&gt;(&amp;lt;- (totype middletype fromtype) object)&lt;/code&gt; was worth
keeping. The &lt;var&gt;&amp;lt;-&lt;/var&gt; macro will rewrite this into calls like
&lt;code&gt;(totype&amp;lt;-middletype (middletype&amp;lt;-fromtype (the fromtype
object)))&lt;/code&gt; (note that &lt;var&gt;the&lt;/var&gt; is used as an optimisation
- this is the kind of thing macros allow us to do!). This means that
you just have to define a function with the name
&lt;var&gt;totype&amp;lt;-middletype&lt;/var&gt;, and then it will automatically be
used by the macro - you don&#039;t even have to export the symbol! Truly,
Paul Graham was inspired when he invented macros (and they &lt;a
href=&quot;http://docs.yahoo.com/docs/pr/release184.html&quot;&gt;certainly paid
off&lt;/a&gt;). Now you could convert types like this:&lt;/p&gt;

&lt;pre&gt;
(&amp;lt;- (integer string) &quot;123&quot;) =&gt; 123
(&amp;lt;- (integer string integer) 123) =&gt; 123
&lt;/pre&gt;

&lt;p&gt;However, I didn&#039;t feel like it was &quot;fully there&quot; yet, as you might
want to define a type conversion function like this: &lt;/p&gt;

&lt;pre&gt;
(defun integer&amp;lt;-string (string &amp;amp;optional
                        (start 0) (end (length string))
                        (radix 10))
  (values (parse-integer string :start start :end end :radix radix)))
&lt;/pre&gt;

&lt;p&gt;I think you should be able to provide values for those optional
arguments. And since I&#039;m writing a type converter, it would be
outright embarrassing if you had to provide those values directly, and
couldn&#039;t convert them from something else - and why not integrate that
directly into the single type-list (the first argument to the macro)?
That is good program design, as it clearly puts all type-specifiers in
a single place. This is now possible:&lt;/p&gt;

&lt;pre&gt;
(&amp;lt;- (integer (string integer)) 1 &quot;123&quot;) =&gt; 23
(&amp;lt;- (integer (string integer integer)) 1 2 &quot;123&quot;) =&gt; 2
(&amp;lt;- (integer (string integer integer)) 1 3 8 &quot;123&quot;) =&gt; 19
&lt;/pre&gt;

&lt;p&gt;As you may note, I decided that the arguments to the type
conversion function should go before the actual object to be
converted. This is good program design, as the overall macro works by
first saying &lt;em&gt;how&lt;/em&gt; to convert something, then providing the
actual value(s). I think the same rule should count for the values. As
an added bonus, it is now possible for machines and humans to perform
sophisticated reasoning about the macro without looking too much at
the type list, as you know things like &quot;the second through to the
second-last argument contains option values&quot; and &quot;the last argument is
the value to be converted&quot;. You may note that the &quot;real&quot; order of
types is preserved in the type list, that&#039;s because it&#039;s more logical
that way. Also, you may argue that Lisp is about freedom, and my
requirement to put parameter values first in the value-list conflicts
with that ideal; but while Lisp is indeed about freedom, putting the
value to be converted first is so plainly wrong that no-one would ever
do it, or expect it to work. Is it really loss of freedom if you
weren&#039;t going to (or weren&#039;t supposed to) do it anyway?&lt;/p&gt;

&lt;p&gt; But wait, there&#039;s more. I mentioned it would be embarrassing if
you couldn&#039;t easily type-convert the optional arguments, so of course
that was implemented too. When the type-list turns into an actual
tree, the objects to be used are retrieved from the object-list as
types are encountered in the tree during a depth-first search (and, of
course, with the above-mentioned rule about the first type in a list,
or the &quot;target type&quot;, being selected last). So you can now write
expressions like: &lt;/p&gt;

&lt;pre&gt;
(&amp;lt;- (integer (string (integer string))) &quot;1&quot; &quot;123&quot;) =&gt; 23
(&amp;lt;- (integer (string (integer string)) integer) &quot;1&quot; 123) =&gt; 23
(&amp;lt;- (integer
     (string (integer string)
             (integer (string integer integer integer)
                      integer))
     integer)
    &quot;0&quot; 0 2 2 10 123) =&gt; 12
&lt;/pre&gt;

&lt;p&gt; The final example above truly shows the power of the
&lt;var&gt;&amp;lt;-&lt;/var&gt; macro. We have (are you ready for this?) an integer,
123, that is converted to a string. This string-conversion takes
arguments, namely an integer that is converted from a string (&quot;0&quot;),
and also (this is the big one) an integer 10, that is converted to a
string, and then back into an integer starting from string offset 0,
ending at 2, and in base 2 (the result is the integer 2, of
course). Finally, the string (which is now &quot;12&quot;) is converted to an
integer, and the final result is thus the integer value 12.&lt;/p&gt;

&lt;p&gt;But of course, if you have nothing but an elegant and succinct
notation, you end up with theoretical mathematics, and I&#039;d like to
take this type conversion utility a bit further than that. Thus it is
useful to predefine a set of type conversion functions. I&#039;d like to
talk a bit about some of the more interesting of these.&lt;/p&gt;

&lt;p&gt;A very common task in modern programming is converting a bit-string
into an integer, this is done via the &lt;code&gt;bitstring&lt;/code&gt; type
(note that this is not defined as a type anywhere - it exists purely
for the function of conversion). The conversion function from
&lt;code&gt;bitstring&lt;/code&gt; reuses the &lt;code&gt;integer&amp;lt;-string&lt;/code&gt;
function, of course - code reuse is a great thing, and that it is
possible is a sure-fire symptom of excellent design:&lt;/p&gt;

&lt;pre&gt;
(defun integer&amp;lt;-binarystring (binarystring)
  (integer&amp;lt;-string binarystring 0 (length binarystring) 2))
&lt;/pre&gt;

&lt;p&gt; Another useful conversion is integers to strings - in many other
languages the null string, the string &quot;0&quot;, the string &quot;false&quot; and
others are all equivalent to the false value, while &quot;1&quot;, &quot;true&quot; and
the like are the true boolean value. I don&#039;t know why this feature
isn&#039;t part of ANSI CL, but I suspect it may have to do with lack of
time and resources on part of the standardisation group. But never
mind that - while Lisp was not the first language to get an object
system, it got the best one by far when it catched up. I was looking
for something similar with this conversion function. There is a list
of strings that are true (&quot;true&quot;, &quot;1&quot;, &quot;correct&quot;, &quot;proper&quot;, etc) and a
list of strings that are false (&quot;false&quot;, &quot;0&quot;, &quot;bad&quot;, &quot;deficient&quot;,
etc), but this alone is just slightly more comprehensive than most
other languages, not in an entirely different league, as CLOS is when
compared to other object systems. Lisp used to be an AI language, and
therefore I felt it would be highly appropriate if this conversion
function used intelligent, language-aware semantics as well as the
plain list, and thus, it handles &quot;in&quot; and &quot;not &quot;-prefixed strings,
meaning that the following useful cases work as one would intuitively
expect:&lt;/p&gt;

&lt;pre&gt;
(&amp;lt;- (boolean string) &quot;true&quot;) =&gt; T
(&amp;lt;- (boolean string) &quot;not true&quot;) =&gt; NIL
(&amp;lt;- (boolean string) &quot;not false&quot;) =&gt; T
(&amp;lt;- (boolean string) &quot;correct&quot;) =&gt; T
(&amp;lt;- (boolean string) &quot;incorrect&quot;) =&gt; NIL
(&amp;lt;- (boolean string) &quot;bad&quot;) =&gt; NIL
(&amp;lt;- (boolean string) &quot;inbad&quot;) =&gt; T
&lt;/pre&gt;

&lt;p&gt; Finally, I&#039;d like to describe the &quot;integer to boolean&quot;
conversion. Conformity with prior experiences, and the expectations
that arise from these, are important when designing intuitive
semantics, so I looked to what boolean values other languages
attribute to integers. The generally accepted pattern seemed to be
&lt;em&gt;0=false, 1=true, ...&lt;/em&gt;, so that is what I implemented:&lt;/p&gt;

&lt;pre&gt;
(defun boolean&amp;lt;-integer (integer)
  (not (zerop (mod integer 2))))
&lt;/pre&gt;

&lt;p&gt;In conclusion, I think I fulfilled my initial design goals of
intuitive semantics and a simple interface for the type conversion
utility library. The source code can be retrieved &lt;a
href=&quot;http://sigkill.dk/code/typeconv.lisp&quot;&gt;here&lt;/a&gt;, but I&#039;m going to
submit it for inclusion into &lt;a
href=&quot;http://common-lisp.net/project/alexandria/&quot;&gt;Alexandria&lt;/a&gt; in a
few days, so you hopefully won&#039;t need to manually include the file in
all your projects in the future.&lt;/p&gt;
 
    </content:encoded>

    <pubDate>Sun, 20 Jan 2008 06:00:00 +0100</pubDate>
    <guid isPermaLink="false">http://sigkill.dk/blog/archives/298-guid.html</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by-sa/2.5/</creativeCommons:license>
</item>
<item>
    <title>I can put *what* in my buffer?</title>
    <link>http://sigkill.dk/blog/archives/297-I-can-put-what-in-my-buffer.html</link>
            <category>Lisp (EN)</category>
    
    <comments>http://sigkill.dk/blog/archives/297-I-can-put-what-in-my-buffer.html#comments</comments>
    <wfw:comment>http://sigkill.dk/blog/wfwcomment.php?cid=297</wfw:comment>

    <slash:comments>9</slash:comments>
    <wfw:commentRss>http://sigkill.dk/blog/rss.php?version=2.0&amp;type=comments&amp;cid=297</wfw:commentRss>
    

    <author>nospam@example.com (Troels Henriksen)</author>
    <content:encoded>
    &lt;p&gt;
&lt;em&gt;Hello, reddit! There&#039;s a link to a screenshot near the bottom, and as an extra treat, this is from my test of the new JPEG reading facilities in &lt;a href=&quot;http://common-lisp.net/project/mcclim&quot;&gt;McCLIM&lt;/a&gt;: &lt;a href=&quot;http://sigkill.dk/athas/jpegsinclimacs.png&quot;&gt;jpegsinclimacs.png&lt;/a&gt;&lt;/em&gt;
&lt;/p&gt;

&lt;p&gt; As some of you may know, &lt;a
href=&quot;http://common-lisp.net/project/climacs/&quot;&gt;Climacs&lt;/a&gt; is an
attempt at writing an Emacs-like editor in Common Lisp. This is
obviously a hard problem that requires a lot of work - I have often
been amazed at just how many exotic cases and conditions GNU Emacs
handles in even simple editing functions. It is a very mature program,
and it shows, while Climacs is still far behind Emacs in terms of
functionality and stability. &lt;/p&gt;

&lt;p&gt; But while clever editing commands and similar things aren&#039;t that
hard to implement - they mostly require time - most peoples initial
impression of Climacs has been one of very bad performance, which is
another class of problem entirely. Climacs was quite sluggish, even on
fast machines, and it&#039;s quite understandable that most people didn&#039;t
get a very good impression of a thin-featured program that was several
orders of magnitude slower than Emacs. To rectify this, I have spent
the last week and a half writing a new redisplay engine for Climacs
(specifically, the editing substrate Drei). Performance is not yet as
good as that of Emacs, nor as good as I would like it to be, but it&#039;s
&lt;em&gt;much&lt;/em&gt; faster than the old engine, and even more important, it
does not get (significantly) slower as the size of the buffer
increases, only the size of the actual displayed buffer region affects
redisplay linearly. While doing research on efficient redisplay in
text editors, I discovered that there isn&#039;t a lot of writing on doing
this on a bit-mapped display with colours - I used an &lt;a
href=&quot;http://www.cs.cmu.edu/~wjh/papers/byte.html&quot;&gt;article on the
Andrew text editor&lt;/a&gt; as initial inspiration, but it didn&#039;t cover
everything I needed to do. Therefore, I&#039;m going to write a bit about
Drei&#039;s redisplay algorithm.&lt;/p&gt;

&lt;p&gt;The redisplay engine was developed based on a key assumption: &lt;a
href=&quot;http://www.lispworks.com/documentation/lw44/CLIM/html/climguide-234.htm#pgfId-347294&quot;&gt;output
records&lt;/a&gt; are nice, flexible and useful, but they are too slow and
heavy. Hence, the redisplay engine does not use output records, except
for handling cursors and some other exotic situations. Instead, it
divides the visible region of the buffer into &lt;em&gt;strokes&lt;/em&gt;. A
stroke is a unique buffer region (does not overlap with other strokes)
that can be drawn in a single operation with a single set of drawing
options, and that does not cross lines. Put another way, a stroke is a
sequence of characters in a line with the same colour and font
(strokes can also cover non-characters, but let&#039;s ignore that for
now). The new redisplay algorithm thus works by fetching strokes from
the buffer, starting at the top of the display, and drawing them to
the screen until we reach either the end of the buffer or the bottom
of the visible part of the output sheet. When strokes are drawn, we
remember the location and size of their output.&lt;/p&gt;

&lt;p&gt;Due to the constraint that strokes cannot cross lines, we can
trivially organise strokes into lines and just check for whether a
stroke directly precedes a &lt;tt&gt;#\Newline&lt;/tt&gt; character to figure out
when we should go to the next line, and when we do this, look at the
strokes of the line and figure out the dimension of the
line. Additionally, we get the nice property, that when redisplay is
finished, no two strokes overlap.&lt;/p&gt;

&lt;p&gt;Stroke objects are kept across display, and are mutated by the
mechanism that retrieves strokes from the buffer (the stroke pump, see
below), so we can easily check whether a stroke has changed (we mark
it as &quot;dirty&quot; and &quot;modified&quot;) since the last redisplay, simply by
having the pump check whether it is going store already-existing data
in the stroke object. If a stroke is obscured for some reason (for
example due to a moving window, or part of the cursor being drawn over
it), we also mark it as dirty. Taken together, this enables
incremental redisplay, as we only redraw strokes that are dirty, and
only recalculate their size if they are modified.&lt;/p&gt;

&lt;p&gt;The interesting problem is now how to generate strokes for the
redisplay engine. This is done through two generic functions,
&lt;tt&gt;pump-state-for-offset&lt;/tt&gt; and &lt;tt&gt;stroke-pump&lt;/tt&gt;, that are used
to &quot;pump&quot; stroke data into existing stroke objects. This is both to
implement incremental redisplay, as mentioned above, and to avoid
consing (if you read the code, you&#039;ll notice that I&#039;ve been obsessed
with minimising consing in general, perhaps this was not always
necessary). For the most common case, these functions just relay to
the syntax of the view, which results in either the simple stroke
pumping defined for Fundamental Syntax, or a general parse-tree walker
defined for LR syntax that can select drawing colours based on the
actual parse symbols (wrapped in some macrology, syntax highlighting
rules can then be defined &lt;a
href=&quot;http://paste.lisp.org/display/53883&quot;&gt;like this&lt;/a&gt;). There is
nothing special about stroke pumping, except that it has to be really
fast, as it is completely non-cached and done in full for every
redisplay. All the clever caching and &quot;only handle that which has
actually changed&quot;-stuff is done at the higher level by looking at the
dirtiness of strokes, and at the lower level by the incremental syntax
parsers. The stroke pump just has to be fast, something that is most
efficiently done by connecting it closely to the parse
information. When the view is a pure &lt;tt&gt;buffer-view&lt;/tt&gt; (that is,
has no syntax) there is a simple fallback pump defined that just turns
each line into a stroke (possibly chopping it up if it&#039;s very long),
it&#039;s not fast, but it&#039;s simple, and you can look at it to get a
general idea of how it works, if you&#039;re curious. It&#039;s defined in
&lt;tt&gt;&lt;a
href=&quot;http://common-lisp.net/cgi-bin/viewcvs.cgi/mcclim/Drei/drei-redisplay.lisp?rev=1.23&amp;amp;root=mcclim&amp;amp;view=markup&quot;&gt;drei-redisplay.lisp&lt;/a&gt;&lt;/tt&gt;&lt;/p&gt;

&lt;p&gt; As an interesting special case, and as hinted at by the title of
this post, strokes do not have to cover sub-strings of the buffer. For
each stroke we have an associated set of drawing options, and in
addition to holding colour and font information, it also contains the
function to be used for drawing the stroke. Commonly, this is the
default function, which copies a string out of the buffer and prints
it with the function &lt;tt&gt;draw-text*&lt;/tt&gt;, but if a sufficient function
is provided, &lt;em&gt;any Lisp object&lt;/em&gt; can be drawn. Indeed,
Fundamental and Lisp syntax recognise non-characters in the buffer,
and create single-object strokes, with a special drawing function, for
these. This function presents the object, via CLIM, and draws the
resulting output record. This means that any Lisp object can at least
be displayed as if by &lt;tt&gt;print-object&lt;/tt&gt;, or if a CLIM presentation
method has been defined, as pretty much anything. &lt;a
href=&quot;http://sigkill.dk/athas/dreiobjects.png&quot;&gt;This screenshot&lt;/a&gt;
demonstrates the feature. Of course, stuffing the buffer full of
arbitrary objects can still fail badly in other ways, as not all
editing commands know how to deal with it. &lt;/p&gt;

&lt;p&gt;In conclusion, if you were previously put off by the poor
performance of Climacs, you should give it another try. It&#039;s not near
Emacs speed yet, but it&#039;s quite usable on modern machines, and should
improve further in the future (compared to the old redisplay engine,
the new can actually be further developed and optimised in a
straightforward way). There&#039;s also a pretty low barrier-to-entry for
hacking, and lots of low-hanging fruit still.&lt;/p&gt;
 
    </content:encoded>

    <pubDate>Wed, 09 Jan 2008 11:47:34 +0100</pubDate>
    <guid isPermaLink="false">http://sigkill.dk/blog/archives/297-guid.html</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by-sa/2.5/</creativeCommons:license>
</item>
<item>
    <title>Structedit: Paredit clone for Climacs</title>
    <link>http://sigkill.dk/blog/archives/295-Structedit-Paredit-clone-for-Climacs.html</link>
            <category>Lisp (EN)</category>
    
    <comments>http://sigkill.dk/blog/archives/295-Structedit-Paredit-clone-for-Climacs.html#comments</comments>
    <wfw:comment>http://sigkill.dk/blog/wfwcomment.php?cid=295</wfw:comment>

    <slash:comments>2</slash:comments>
    <wfw:commentRss>http://sigkill.dk/blog/rss.php?version=2.0&amp;type=comments&amp;cid=295</wfw:commentRss>
    

    <author>nospam@example.com (Troels Henriksen)</author>
    <content:encoded>
    &lt;p&gt; For some time now, I have been using &lt;a
href=&quot;http://mumble.net/~campbell/emacs/paredit.el&quot;&gt;Paredit&lt;/a&gt; for
editing Common Lisp code in Emacs (if you don&#039;t already, you should
start too!). It&#039;s a highly useful approximation of an actual structure
editor, with the important detail that it modifies the files just as a
sequence of characters, putting intelligence into the editing commands
rather than the data structure, and so works perfectly with all the
tools that expect flat character files. While I can&#039;t claim to write
much code with &lt;a
href=&quot;http://common-lisp.net/project/climacs/&quot;&gt;Climacs&lt;/a&gt;, whenever I
do, I am annoyed by the lack of Paredit. Thus, I spent some time
implementing a &lt;a
href=&quot;http://sigkill.dk/code/climacs-structured-editing.lisp&quot;&gt;preliminary
version of a Paredit clone for Climacs&lt;/a&gt; (named &lt;em&gt;Structedit&lt;/em&gt;,
as I want to emphasise the similarity to proper structure editors). It
is not a perfect clone, apart from being &lt;em&gt;far&lt;/em&gt; less
full-featured and tested, it implements a few facilities slightly
differently from Paredit. The base is (or should be) the same, however
&lt;/p&gt;

&lt;p&gt; While hacking out the code, I performed a number of observations:
&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
  Having a full-fledged parse tree at your fingertips is highly
  useful for writing this kind of code, but it does not free you from
  handling special-cases when it comes to actually modifying the
  buffer. Also, interrogating the parse tree for information is tricky
  and requires in-depth knowledge of how it looks, meaning that a
  large number of utility functions are probably needed if it is to be
  possible to write syntax-functions without spending a lot of time
  studying the syntax implementation first.
  &lt;/li&gt;
  &lt;li&gt;
  Climacs needs toggle-able &quot;modes,&quot; like minor modes in
  Emacs. Currently, Structedit just overwrites the default key-bindings
  of Lisp syntax in Climacs.
  &lt;/li&gt;
  &lt;li&gt;
  Generic functions should be used more often to implement user-level
  functionality, and these must dispatch on something that can be
  modified by &quot;modes.&quot; For example, Structedit introduces new commands
  for &lt;kbd&gt;C-d&lt;/kbd&gt; and &lt;kbd&gt;Backspace&lt;/kbd&gt;, but if the user has
  bound some other key globally to, say, &lt;tt&gt;Delete Object&lt;/tt&gt;, the
  default &lt;tt&gt;Delete Object&lt;/tt&gt; will be used whenever he presses it,
  instead of the structurally aware variant of &lt;tt&gt;Delete Object&lt;/tt&gt;
  provided by Structedit. As far as I know, Emacs suffers a bit from
  this as well.
  &lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;
Structedit requires the newest CVS-version of McCLIM, and its commands
are not yet as comprehensive as those of Paredit, so use at own
risk. If you&#039;re feeling adventurous, try hacking in some missing
functionality (&lt;kbd&gt;C-k&lt;/kbd&gt; is a bit bare-bones, if you need a
starting point); it shouldn&#039;t be &lt;em&gt;too&lt;/em&gt; hard.
&lt;/p&gt;
 
    </content:encoded>

    <pubDate>Thu, 27 Dec 2007 16:35:22 +0100</pubDate>
    <guid isPermaLink="false">http://sigkill.dk/blog/archives/295-guid.html</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by-sa/2.5/</creativeCommons:license>
</item>
<item>
    <title>Views in Climacs - gratuitous complexity ahoy!</title>
    <link>http://sigkill.dk/blog/archives/293-Views-in-Climacs-gratuitous-complexity-ahoy!.html</link>
            <category>Lisp (EN)</category>
    
    <comments>http://sigkill.dk/blog/archives/293-Views-in-Climacs-gratuitous-complexity-ahoy!.html#comments</comments>
    <wfw:comment>http://sigkill.dk/blog/wfwcomment.php?cid=293</wfw:comment>

    <slash:comments>2</slash:comments>
    <wfw:commentRss>http://sigkill.dk/blog/rss.php?version=2.0&amp;type=comments&amp;cid=293</wfw:commentRss>
    

    <author>nospam@example.com (Troels Henriksen)</author>
    <content:encoded>
    &lt;p&gt;

Some time ago, &lt;a
href=&quot;http://dept-info.labri.fr/~strandh/index.en.html&quot;&gt;Robert
Strandh&lt;/a&gt; proposed to change Climacs by moving away from the classic
Emacs concept of operating on buffers, and insert a middle layer of
objects called &quot;views&quot;. I just spent the two weeks implementing his
ideas in Drei and Climacs itself, prompting me to write this blog
post.

&lt;/p&gt;

&lt;p&gt;

So, presuming you care about Climacs, why should you care about views?
What problem do they solve. To put it in somewhat simplified terms,
the problem with the Emacs buffer/mode-concept is that a single buffer
can only be in a single major mode (called &quot;syntax&quot; in Climacs
parlance) at a time, and any enabled modes is an intrinsic quality of
the buffer itself. This prevents some neat programs from being written
(more on this below), and prevents the user from having a buffer
displayed in two separate windows with two different rules for syntax
highlighting.
&lt;/p&gt;

&lt;p&gt;

Of course, this is a rather dubious usage scenario, so
let&#039;s grab hold of a concrete problem views solve for
Drei (the editing substrate
behind Climacs). Essentially, Climacs had a very ugly problem, wherein commands
making multiple operations on a buffer had to call the function
&lt;tt&gt;update-syntax&lt;/tt&gt; to make sure the syntax parse tree was up to
date with the buffer contents - failure to do so could cause commands
to behave strangely (as with the &lt;tt&gt;Indent Region&lt;/tt&gt;-command before
it updated the syntax after indenting each line) or crash outright, as
with some of the more complex commands in Lisp syntax. So, easy
solution: make syntax functions call &lt;tt&gt;update-syntax&lt;/tt&gt; themselves
to make sure they always operate on, or return, up-to-date
information. Well, not so easy as it seems, as the only place a
description of buffer-changes, since the last syntax-update was
performed, was stored, was in the buffer object itself, and
&lt;tt&gt;update-syntax&lt;/tt&gt; would overwrite this information with a &quot;no
changes&quot; flag, which might not be expected by other pieces of code
interested in when the buffer changes. To be fair, some Emacs-style
hacks could have been implemented, buffers could have been tied
inseparately to their chosen syntax, and we&#039;d end up with something
usable. But the pain this would bring if we want to do more
complicated things with buffers and syntaxes (like having two windows
displaying the same buffer of HTML code, one showing
syntax-highlighted raw code, and the other showing a rendered WYSIWYG
version) made this seem like a really bad idea.

&lt;/p&gt;

&lt;p&gt;

With views, the syntax is not an intrinsic property of a buffer,
rather it is a property of a specific &lt;em&gt;view&lt;/em&gt; of a buffer, and a
buffer is not specific to anything, except the Climacs instance
itself. The new buffer-modification-protocol enables views to register
themselves as observers of a buffer object and be notified whenever
changes happen, with a description of what part of the buffer was
modified by the changes. The view can then maintain a clear picture of
how much of the buffer changed since the views internal data
structures were last synchronised to the actual buffer contents (for a
typical view, this will be a parse tree based on some
grammar). Whenever a view is asked to do something (like, redisplay
itself on a pane) it will synchronise itself, using its stored
information about buffer changes to figure out which parts of its data
is outdated and needs to be brought up to date. In Climacs, views are
dealt with in approximately the same way as buffers - you use &lt;tt&gt;C-x
C-b&lt;/tt&gt; to change between them, &lt;tt&gt;C-x k&lt;/tt&gt; to kill them, etc, but
there are some minor differences, in particular because a view cannot
be displayed in more than one window at a time (in contrast to Emacs
buffers).

&lt;/p&gt;

&lt;p&gt;

An interesting consequence of views is that there is no rule for how a
view of a given buffer should be presented - the obvious way is of
course to show the contents of the buffer coloured to fit some
provided syntax scheme, but an interesting alternative is to show a
more high-level interpretation of the buffer contents. For instance,
&lt;a href=&quot;http://sigkill.dk/code/defun-list-view.lisp&quot;&gt;this file&lt;/a&gt;
defines a view displaying the definitions of a Lisp buffer of some
other view (&lt;a
href=&quot;http://sigkill.dk/code/defun-view-example.png&quot;&gt;screenshot of
incestuous use here&lt;/a&gt;), with each definition being a clickable
hyperlink to its location in the buffer (this is CLIM, after all). The
view is automatically updated whenever the buffer contents change,
removing a lot of the tedium of writing somewhat interesting views. Of
course, there&#039;s still problems: the Climacs UI is not really geared to
deal with so unusual views yet, and the two views both maintain their
own parse trees of the buffer, despite the fact that they&#039;re
equivalent. Some optimisation is probably in order here. Of course,
Drei, Climacs and McCLIM has slightly more pressing needs than the
implementation of whimsy views of dubious utility, so it is unlikely
this particular situation will improve significantly any time soon.

&lt;/p&gt; 
    </content:encoded>

    <pubDate>Mon, 10 Dec 2007 23:13:58 +0100</pubDate>
    <guid isPermaLink="false">http://sigkill.dk/blog/archives/293-guid.html</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by-sa/2.5/</creativeCommons:license>
</item>
<item>
    <title>Improvements to Drei's Lisp syntax module</title>
    <link>http://sigkill.dk/blog/archives/281-Improvements-to-Dreis-Lisp-syntax-module.html</link>
            <category>Lisp (EN)</category>
    
    <comments>http://sigkill.dk/blog/archives/281-Improvements-to-Dreis-Lisp-syntax-module.html#comments</comments>
    <wfw:comment>http://sigkill.dk/blog/wfwcomment.php?cid=281</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://sigkill.dk/blog/rss.php?version=2.0&amp;type=comments&amp;cid=281</wfw:commentRss>
    

    <author>nospam@example.com (Troels Henriksen)</author>
    <content:encoded>
    &lt;p&gt; During a semi-recent reading of &lt;a
href=&quot;http://www.cs.cmu.edu/Groups/AI/html/cltl/cltl2.html&quot;&gt;CLtL2&lt;/a&gt;,
I came upon a feature of macro lambda lists I had not seen before -
namely, the ability to create destructuring optional and keyword
parameters in addition to the common positional destructuring
parameters. I wondered why I had never seen this feature used in any
of the code I had read, and came to the conclusion that it had to be
SLIME&#039;s poor support for destructuring parameters in general. I
decided to spend some time implementing this critical feature in &lt;a
href=&quot;http://common-lisp.net/project/climacs/&quot;&gt;Climacs&lt;/a&gt;, and on the
way created a protocol for handling lambda lists that combines the
ease of use of pathnames with the performance of CLIM incremental
redisplay. &lt;a href=&quot;http://sigkill.dk/code/dreill1.png&quot;&gt;This&lt;/a&gt; is a
screenshot and &lt;a href=&quot;http://sigkill.dk/code/dreill2.png&quot;&gt;this&lt;/a&gt;
is too.&lt;/p&gt;

&lt;p&gt; Now, what&#039;s next? Ironing out the last Drei input-editing bugs is
probably in order, and adding more indentation rules (like
&lt;tt&gt;:method&lt;/tt&gt;-options to &lt;tt&gt;defgeneric&lt;/tt&gt; forms, something SLIME
doesn&#039;t handle well either) and restoring Climacs&#039; &quot;group&quot; feature (a
facility for performing commands, such as search/replace, across
several buffers or files) is probably also due. Now, the elephant in
the china store is still redisplay, of course. I suspect anyone who
has tried out Climacs has first and foremost experienced the very poor
redisplay performance, compared to just about every other editor. The
problem here is that there doesn&#039;t seem to be any consensus on why
McCLIM&#039;s incremental redisplay is so slow, or if it&#039;s even supposed to
be usable for real-time redrawing as in an editor, and in that case,
what to replace it with. I guess a first try would be to examine other
editors redisplay engines, copy what they do, and try to fit it into
the CLIM framework. One potential source of hair is that the Climacs
display contains full-fledged CLIM presentations, meaning that they
are automatically click-sensitive when applicable, and associated with
some Lisp object in the CLIM way, and it&#039;d be nice to retain this
functionality even if Climacs (actually, its editor substrate, &lt;a
href=&quot;http://boinkor.net/archives/2006/11/drei_revives_eremites_interest.html&quot;&gt;Drei&lt;/a&gt;)
ends up doing its own drawing.&lt;/p&gt;

&lt;p&gt;Anyway, the nice thing is that no matter what the redisplay engine
ens up like, the improvements based on the syntax and buffer
representations will stay usable without further work, so when
redisplay performance becomes good enough, Climacs should already be a
fairly capable editor.&lt;/p&gt;
 
    </content:encoded>

    <pubDate>Tue, 14 Aug 2007 00:15:00 +0200</pubDate>
    <guid isPermaLink="false">http://sigkill.dk/blog/archives/281-guid.html</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by-sa/2.5/</creativeCommons:license>
</item>
<item>
    <title>One more C syntax screenshot</title>
    <link>http://sigkill.dk/blog/archives/269-One-more-C-syntax-screenshot.html</link>
            <category>Lisp (EN)</category>
    
    <comments>http://sigkill.dk/blog/archives/269-One-more-C-syntax-screenshot.html#comments</comments>
    <wfw:comment>http://sigkill.dk/blog/wfwcomment.php?cid=269</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://sigkill.dk/blog/rss.php?version=2.0&amp;type=comments&amp;cid=269</wfw:commentRss>
    

    <author>nospam@example.com (Troels Henriksen)</author>
    <content:encoded>
    &lt;p&gt;
McCLIM and Climacs development has been somewhat silent for the last few weeks, but a few days ago, John Q. Splittist created that thing that most Climacs hackers have always agreed would be nice to have, but nobody really implemented: &lt;a href=&quot;http://splittist.livejournal.com/2619.html&quot;&gt;a C syntax module&lt;/a&gt;. At the same time, he also factored the general LR parsing stuff out of the Lisp syntax module in order to make it somewhat easier to make relatively fast parsers for Drei, the editing substrate of Climacs. The C syntax module itself lives in the Climacs repository, but since Drei syntaxes are global, all Drei-using programs can make use of it. And also, since Drei is meant to be polymorphic, the C syntax module is automagically available in the input-editor version as well, which can lead to interesting (to me!) hacks: &lt;a href=&quot;http://sigkill.dk/athas/drei-c-syntax.png&quot;&gt;screenshot!&lt;/a&gt;
&lt;/p&gt;

&lt;p&gt;
(I should note that the presentation type definition on that screenshot has a bug: it really should have &lt;em&gt;:inherit-from &#039;string&lt;/em&gt;, or CLIM will complain that it cannot convert the typed input to a Lisp object.)
&lt;/p&gt;

&lt;p&gt;
So, now that the hard part of the job is done, who&#039;s going to write that C Listener?
&lt;/p&gt; 
    </content:encoded>

    <pubDate>Fri, 27 Apr 2007 23:46:42 +0200</pubDate>
    <guid isPermaLink="false">http://sigkill.dk/blog/archives/269-guid.html</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by-sa/2.5/</creativeCommons:license>
</item>
<item>
    <title>CLIM-Desktop 0.2 x86 binaries</title>
    <link>http://sigkill.dk/blog/archives/254-CLIM-Desktop-0.2-x86-binaries.html</link>
            <category>Lisp (EN)</category>
    
    <comments>http://sigkill.dk/blog/archives/254-CLIM-Desktop-0.2-x86-binaries.html#comments</comments>
    <wfw:comment>http://sigkill.dk/blog/wfwcomment.php?cid=254</wfw:comment>

    <slash:comments>2</slash:comments>
    <wfw:commentRss>http://sigkill.dk/blog/rss.php?version=2.0&amp;type=comments&amp;cid=254</wfw:commentRss>
    

    <author>nospam@example.com (Troels Henriksen)</author>
    <content:encoded>
    &lt;p&gt;
Based on Christophe Rhodes&#039; &lt;a href=&quot;http://www.advogato.org/person/crhodes/diary.html?start=98&quot;&gt;earlier work&lt;/a&gt;, I have created some standalone binaries of &lt;a href=&quot;http://www.common-lisp.net/project/clim-desktop&quot;&gt;CLIM-Desktop&lt;/a&gt; using SBCL&#039;s simple facility for creating executable images. They were built with SBCL 1.0 on GNU/Linux on a standard 32bit x86 machine, and have been thoroughly tested (by McCLIM standards) on other machines. When run, the CLIM Launcher program will start and present a short menu of available CLIM applications, with the exceptions of the Listener and the Inspector, and the image will terminate when the launcher application is stopped (and you won&#039;t be queried for saving work you have open in, for example, the editor, so be careful). Apart from the usual bugs you might find in McCLIM, CLIM-Desktop undoubtedly introduces a bunch of new ones, but the amount of total Lisp system corrupting bugs should be fairly low, so at worst, you should just get dumped into the CLIM debugger. Of course, if you mess up the connection to the X server, the debugger won&#039;t run, and SBCL can get mighty surly.
&lt;/p&gt;

&lt;p&gt;
The applications and libraries included are mostly CVS versions, with a few patches here and there to work around the most common bugs and display a little bit of extra demo-stuff. These are the ASDF systems loaded and willing to provide a version number: usocket 0.2.4, cl-irc 0.8-dev, cl-ppcre 1.2.12, cl-fad 0.5.0, bordeaux-threads 0.0.1, trivial-sockets 0.2, flexi-streams 0.5.7, skippy 1.3, clim-desktop 0.2, sb-bsd-sockets 0.58, sb-grovel 0.01, clx 0.7.2, flexichain 1.1, mcclim 0.9.4, split-sequence 20011114.1 and asdf-binary-locations 0.1. The real list is significantly larger, so it might be hard to convince someone to set up all of that just to try out CLIM-Desktop, but hopefully, this release will make people more receptive, once they&#039;ve tried it and discovered that it isn&#039;t solely hot air. The only thing I can immediately think of that won&#039;t work is the Meta-click functionality, where you can hold Meta and click on certain things (symbols, classes, functions, commands) and be taken to their definition in the editor, because the source code isn&#039;t available. You need the full version for that! Also added is the use of the M-Tab gesture for general completion during input-editing, because the default (Mouse-2) is annoying. The program used to build the CLIM Desktop binary is &lt;a href=&quot;http://sigkill.dk/code/make-clim-desktop.lisp&quot;&gt;available here&lt;/a&gt;.
&lt;/p&gt;

&lt;p&gt;
There are two versions available, if one doesn&#039;t work, try the other: &lt;a href=&quot;http://www.common-lisp.net/project/clim-desktop/clim-desktop-0.2.tar.bz2&quot;&gt;CLIM-Desktop 0.2 with Freetype&lt;/a&gt;, &lt;a href=&quot;http://www.common-lisp.net/project/clim-desktop/clim-desktop-0.2-nofreetype.tar.bz2&quot;&gt;CLIM-Desktop 0.2 without Freetype&lt;/a&gt;.
&lt;/p&gt; 
    </content:encoded>

    <pubDate>Wed, 17 Jan 2007 22:42:27 +0100</pubDate>
    <guid isPermaLink="false">http://sigkill.dk/blog/archives/254-guid.html</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by-sa/2.5/</creativeCommons:license>
</item>
<item>
    <title>McCLIM 0.9.4 &quot;Orthodox New Year&quot; released</title>
    <link>http://sigkill.dk/blog/archives/253-McCLIM-0.9.4-Orthodox-New-Year-released.html</link>
            <category>Lisp (EN)</category>
    
    <comments>http://sigkill.dk/blog/archives/253-McCLIM-0.9.4-Orthodox-New-Year-released.html#comments</comments>
    <wfw:comment>http://sigkill.dk/blog/wfwcomment.php?cid=253</wfw:comment>

    <slash:comments>1</slash:comments>
    <wfw:commentRss>http://sigkill.dk/blog/rss.php?version=2.0&amp;type=comments&amp;cid=253</wfw:commentRss>
    

    <author>nospam@example.com (Troels Henriksen)</author>
    <content:encoded>
    &lt;p&gt;
  Today, version 0.9.4 of McCLIM was released. McCLIM is a free and
  increasingly-complete implementation of
  the &lt;a
         href=&quot;http://www.stud.uni-karlsruhe.de/~unk6/clim-spec/&quot;&gt;Common Lisp
    Interface Manager 2.0 specification&lt;/a&gt;. Version 0.9.4 has some
  nifty new features that make McCLIM nicer to use - for one, the old
  editor substrate, Goatee, has been replaced with a new one based on
  Climacs code - &lt;acronym title=&quot;Drei Replaces EINE&#039;s
                                 Inheritor&quot;&gt;Drei&lt;/acronym&gt;. In general, Drei has a lot of nifty
  features that Goatee lacks, such as syntax-highlighting and an
  official way of defining new commands. When using the CLIM Listener,
  you now get proper syntax-highlighting and symbol-completion,
  bringing it closer to being a usable tool. Drei has some problems,
  though, some of which it has inherited from Climacs. For one, it has
  quite slow redisplay. Secondly, it&#039;s quite complex and offers far
  more nooks and crannies for bugs to hide in. Thirdly, it attempts to
  do some things (such as literal Lisp objects in the buffer and
  variable-width fonts) that prevent us from handling some things
  easily. If you hit a bug in Drei that totally prevents your favorite
  CLIM application from working, there is a not-so-secret internal
  variable, &lt;tt&gt;clim-internals::*use-goatee*&lt;/tt&gt; that you can set to
  true in order to disable Drei and use the old editor substrate
  instead.
&lt;/p&gt;

&lt;p&gt;
  One of the main points of Drei was to provide the ability to define
  editing commands that apply in every text-editing context across
  CLIM applications, and I think it&#039;s become as easy as
  possible. Here&#039;s an example (adapted from the under-development
  McCLIM User&#039;s Manual).
&lt;/p&gt;

&lt;p&gt;
  A common text editing task is to repeat the word at point, but for
  some reason, Drei does not come with a command to do this, so we
  need to write our own. Fortunately, Drei is extensible software, and
  to that end, a &lt;tt&gt;DREI-USER&lt;/tt&gt; package is provided that is
  intended for user customizations. We&#039;re going to create a standard
  CLIM command named
  &lt;tt&gt;com-repeat-word&lt;/tt&gt; in the command table &lt;tt&gt;editing-table&lt;/tt&gt;. The
  implementation consists of cloning the current point, move it a word
  backward, and insert into the buffer the sequence delimited by point and
  our moved mark. Our command takes no arguments.
&lt;/p&gt;

&lt;pre&gt;
(define-command (com-repeat-word :name t
                                 :command-table editing-table)
    ()
  (let ((mark (clone-mark *current-point*)))
    (backward-word mark *current-syntax* 1)
    (insert-sequence mark (region-to-sequence mark *current-point*))))
&lt;/pre&gt;

&lt;p&gt;
  &lt;var&gt;*current-point*&lt;/var&gt; and &lt;var&gt;*current-syntax*&lt;/var&gt; are two
  of a number of special variables that provide access to editor state
  during command invocation.
&lt;/p&gt;

&lt;p&gt;
  This command facilitates the single repeat of a word, but that&#039;s
  it. This is not very useful - instead, we would like a command that
  could repeat a word an arbitrary (user-supplied) number of
  times. The primary way for a CLIM command to ask for user-supplied
  values is to use command arguments. We define a new command that
  takes an integer argument specifying the number of times to repeat
  the word at point.
&lt;/p&gt;

&lt;pre&gt;
(define-command (com-repeat-word :name t
                                 :command-table editing-table)
    ((count &#039;integer :prompt &quot;Number of repeats&quot;))
  (let ((mark (clone-mark *current-point*)))
    (backward-word mark *current-syntax* 1)
    (let ((word (region-to-sequence mark *current-point*)))
      (dotimes (i count)
        (insert-sequence mark word)))))
&lt;/pre&gt;

&lt;p&gt;
  Great - our command is now pretty full-featured. But with an editing
  operation as common as this, we really want it to be quickly
  accessible via some intuitive keystroke. We
  choose &lt;kbd&gt;M-C-r&lt;/kbd&gt;. Also, it&#039;d be nice if, instead of
  interactively querying us for commands, the command would just use
  the value of the numeric argument as the number of times to
  repeat. There&#039;s currently no way to do this with a named command
  (SE. when you run the command with &lt;kbd&gt;M-x&lt;/kbd&gt;), but it&#039;s quite
  easy to do in a keybinding. We use the &lt;tt&gt;set-key&lt;/tt&gt; function
  from ESA:
&lt;/p&gt;

&lt;pre&gt;
(set-key `(com-repeat-word ,*numeric-argument-marker*)
         &#039;editing-table
         &#039;((#\r :control :meta)))
&lt;/pre&gt;

&lt;p&gt;
  Now, pressing &lt;kbd&gt;M-C-r&lt;/kbd&gt; will result in
  the &lt;tt&gt;com-repeat-word&lt;/tt&gt; command being run with the first
  argument substituted for the value of the numeric argument. Since
  the numeric argument will be 1 if nothing else has been specified by
  the user, we are guaranteed that the first argument is always an
  integer, and we are guaranteed that the &lt;var&gt;count&lt;/var&gt; argument
  will have a sensible default, even if the user does not explicitly
  provide a numeric argument.
&lt;/p&gt;

&lt;p&gt;
  There are many other improvements, the most majors ones probably the
  improvements to Gtkairo, but since I do not work on Gtkairo, so I do
  not feel qualified to talk much about them (but you
  can &lt;a href=&quot;http://sigkill.dk/athas/gtkairoshots/&quot;&gt;look at some
  screenshots&lt;/a&gt;). There is also still much work to be done. I don&#039;t
  have a TODO-list, as that suggests some kind of discipline, but I do
  have a NICE-TO-DO list:
&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;Make Drei redisplay less slow and structure the output records
  so variable-width fonts and variable-width lines can be implemented
  sanely and efficiently. Perhaps by improving the performance of
  McCLIM incremental redisplay?&lt;/li&gt;
  &lt;li&gt;I suspect that it should be possible to call presentation
  generic functions for objects that have defined a method
  on &lt;tt&gt;presentation-type-specifier-p&lt;/tt&gt; that returns T. Current
  McCLIM has some internal function try to find the metaclass for a
  candidate object, and error out if it can&#039;t find it.&lt;/li&gt;
  &lt;li&gt;Presentation histories still do not behave exactly as people
  might expect, as they do not actually store the textual
  input. Perhaps they should? Views would have to be handled
  somehow.&lt;/li&gt;
  &lt;li&gt;&lt;a
  href=&quot;http://www.sts.tu-harburg.de/~r.f.moeller/uims-clim/example-3.gif&quot;&gt;Gadget
  views (picture)!&lt;/a&gt;&lt;/li&gt;
  &lt;li&gt;Maybe revise the names of the Drei special variables. Why not
  just &lt;var&gt;*buffer*&lt;/var&gt; instead of &lt;var&gt;*current-buffer*&lt;/var&gt;?
  And &lt;var&gt;*current-window*&lt;/var&gt; should probably
  be &lt;var&gt;*editor*&lt;/var&gt;, since it&#039;s not really a window when the
  command is running for an input-editor.&lt;/li&gt;
  &lt;li&gt;Implement an output-record based minibuffer for the input-editor
  so we can have &lt;kbd&gt;M-x&lt;/kbd&gt; extended commands.&lt;/li&gt;
  &lt;li&gt;Fix the layout managing of certain composite classes. Many of
  them just ignore the &lt;var&gt;max-width&lt;/var&gt; and &lt;var&gt;max-height&lt;/var&gt;
  attributes of they child panes, leading to visual distortion or just
  having your space requirements plain ignored, which can be very
  frustrating.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;
  If you have never tried McCLIM before, now&#039;s a good opportunity to
  try it out. This release points out two significant things - that
  McCLIM doesn&#039;t have to be ugly (see Gtkairo), and that non-Emacs
  text editors don&#039;t have to be weak. I&#039;m probably biased, but seeing
  the glimpses of Drei&#039;s potential has made me far more certain that
  the whole &quot;put Emacs in everything&quot; idea (as opposed to &quot;put
  everything in Emacs&quot;) is going to work out fine.
&lt;/p&gt;
 
    </content:encoded>

    <pubDate>Sun, 14 Jan 2007 23:44:25 +0100</pubDate>
    <guid isPermaLink="false">http://sigkill.dk/blog/archives/253-guid.html</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by-sa/2.5/</creativeCommons:license>
</item>
<item>
    <title>The FiveAM regression testing framework</title>
    <link>http://sigkill.dk/blog/archives/245-The-FiveAM-regression-testing-framework.html</link>
            <category>Lisp (EN)</category>
    
    <comments>http://sigkill.dk/blog/archives/245-The-FiveAM-regression-testing-framework.html#comments</comments>
    <wfw:comment>http://sigkill.dk/blog/wfwcomment.php?cid=245</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://sigkill.dk/blog/rss.php?version=2.0&amp;type=comments&amp;cid=245</wfw:commentRss>
    

    <author>nospam@example.com (Troels Henriksen)</author>
    <content:encoded>
    &lt;p&gt;
  By a twist of fate, I have been introduced to two different test
  frameworks these past two weeks
  - &lt;a href=&quot;http://www.junit.org/index.htm&quot;&gt;JUnit&lt;/a&gt; for Java and
  &lt;a href=&quot;http://common-lisp.net/project/bese/FiveAM.html&quot;&gt;FiveAM&lt;/a&gt;
  for Common Lisp. This has given me an interesting opportunity to
  look at how tool design differs between these two languages - in
  JUnit, I had to define a class (inherited from a
  JUnit &lt;tt&gt;TestCase&lt;/tt&gt; class) and define methods on it. These
  methods could contain calls to handy assertion methods, such
  as &lt;tt&gt;AssertTrue&lt;/tt&gt; and &lt;tt&gt;AssertEqual&lt;/tt&gt;, that were used to
  actually perform tests. Then I have to create a test suite, add my
  classes to it, provide a &lt;tt&gt;TestResult&lt;/tt&gt; object for the suite,
  wherein the test results will be dumped; after that, I can enumerate
  through the failures (again objects) and figure out what to do. This
  is quite a bit of overhead for simply running tests, in my opinion,
  and it doesn&#039;t seem like much is done on improving it, since most
  Java IDE&#039;s make this process way less painful. (In general, you just
  point at a file containing a test case class definition and press
  &quot;Run test&quot;, but that doesn&#039;t help me that much when I prefer to use
  Emacs.)
&lt;/p&gt;

&lt;p&gt;
  FiveAM is far simpler, at least for a Lisper. You just define your
  tests with the &lt;tt&gt;test&lt;/tt&gt; macro, use the simple &lt;tt&gt;is&lt;/tt&gt; macro
  for most of the assertions, and use the &lt;tt&gt;run!&lt;/tt&gt; function to
  run a test and print the result to standard output. If you want more
  organization, and you probably do for large sets of tests, you
  use &lt;tt&gt;def-suite&lt;/tt&gt; to define a test suite, and &lt;tt&gt;in-suite&lt;/tt&gt;
  with a test suite argument to activate it - thereafter,
  the &lt;tt&gt;test&lt;/tt&gt; macro will put the test in the specified test
  suite. It&#039;s simple, easy and convenient. Also, due to the use of
  macros, testing for such things as whether a given expression
  signals a condition/throws an exception can be expressed in a much
  more elegant way than in JUnit.
&lt;/p&gt;

&lt;p&gt;
  One thing one has to be aware of, though, is that FiveAM doesn&#039;t
  wrap the body of the &lt;tt&gt;test&lt;/tt&gt; macro in a lambda form and stores
  it in the test suite - it stores the literal code and (re)compiles
  it every time the test is run. This has at least one good point, as
  well as some bad ones - on the upside, it means that if you redefine
  a macro, you don&#039;t have to redefine the test to apply the changes -
  they&#039;re automatically picked up when the macro is expanded at the
  compilation step when running the test. On the downside, running
  tests can take a very long time due to the compilation, you&#039;re not
  informed of compiler warnings when you define the test and, worst of
  all, the tests are compiled and evaluated in the null lexical
  environment, which means you can&#039;t do things such
  as &lt;tt&gt;(with-neat-test-function (test my-test-1 (neat-test ...) ...)
  ...  (test my-test-n (neat-test ...) ...))&lt;/tt&gt;.
&lt;/p&gt;

&lt;p&gt;
  All in all, I&#039;m highly satisfied with FiveAM - it&#039;s simple to use
  (and I really don&#039;t see a good reason for why a test framework
  should be complex) and does what it&#039;s supposed to do. It&#039;s a really
  nice tool, and I recommend it to every Lisp programmer who is trying
  to decide upon a test framework.
&lt;/p&gt;
 
    </content:encoded>

    <pubDate>Tue, 05 Dec 2006 21:31:33 +0100</pubDate>
    <guid isPermaLink="false">http://sigkill.dk/blog/archives/245-guid.html</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by-sa/2.5/</creativeCommons:license>
</item>
<item>
    <title>CLIM environment screenshots</title>
    <link>http://sigkill.dk/blog/archives/241-CLIM-environment-screenshots.html</link>
            <category>Lisp (EN)</category>
    
    <comments>http://sigkill.dk/blog/archives/241-CLIM-environment-screenshots.html#comments</comments>
    <wfw:comment>http://sigkill.dk/blog/wfwcomment.php?cid=241</wfw:comment>

    <slash:comments>6</slash:comments>
    <wfw:commentRss>http://sigkill.dk/blog/rss.php?version=2.0&amp;type=comments&amp;cid=241</wfw:commentRss>
    

    <author>nospam@example.com (Troels Henriksen)</author>
    <content:encoded>
    &lt;p&gt;
  For me, one of the goals of
  the &lt;a href=&quot;http://common-lisp.net/project/mcclim&quot;&gt;McCLIM&lt;/a&gt; project
  is to facilitate the creation of an environment where everything is
  written in Lisp. The difference from the other failed (or stagnant)
  LispOS projects is that this is a top-down effort where we start with
  writing directly-usable (well, somewhat) applications instead of
  hacking on device drivers and that sort of thing, so we get useful
  results fairly quickly. If you pair McCLIM
  with &lt;a href=&quot;http://common-lisp.net/project/eclipse/&quot;&gt;Eclipse&lt;/a&gt;,
  you get an environment that is Lisp all the way down to the socket
  talking to the X server. (The fonts in the screenshots aren&#039;t Lisp,
  though, and the optional interface to Freetype is based on FFI. Also,
  I use a C program to take the screenshots). This morning, I took a few
  screenshots of what this looks like:
&lt;/p&gt;

&lt;ul&gt;
  &lt;li&gt;
    &lt;a href=&quot;http://sigkill.dk/athas/climdshots/1.png&quot;&gt;Here&lt;/a&gt; we see
    that &lt;a href=&quot;http://common-lisp.net/project/closure/&quot;&gt;Closure&lt;/a&gt;,
    the CLIM webbrowser written by Gilbert Baumann, is capable of
    displaying all websites of significance, though it seems to dislike
    some of the characters in the entry titles. (Closure needs quite some
    love, so if you feel like hacking on a somewhat-crufty CLIM program,
    here is a great opportunity!)
  &lt;/li&gt;
  &lt;li&gt;
    &lt;a href=&quot;http://common-lisp.net/project/beirc&quot;&gt;Beirc&lt;/a&gt;, the premier
    CLIM IRC client works with Closure,
    &lt;a href=&quot;http://sigkill.dk/athas/climdshots/2.png&quot;&gt;as seen here&lt;/a&gt;,
    if you
    use &lt;a
           href=&quot;http://common-lisp.net/project/clim-desktop&quot;&gt;CLIM-Desktop&lt;/a&gt;. Beirc
  is actually a pretty nifty application in its own right, probably one
  of the most directly usable CLIM applications I know of.
&lt;/li&gt;
&lt;li&gt;
  As seen
  on &lt;a href=&quot;http://sigkill.dk/athas/climdshots/3.png&quot;&gt;this&lt;/a&gt;
  screenshot, I got tired of using the Listeners &lt;tt&gt;Run&lt;/tt&gt; command
  explicitly, so I wrote a little function to do it for me (twice,
  because I got it wrong the first time, which cause the also-Lisp
  CLIM Debugger to pop up). If you use Drei, the Climacs-based editor
  substrate, you get nice things such as syntax-highlighting and
  symbol-completion in the Listener. Parameter hinting doesn&#039;t work
  that well, because the Listener doesn&#039;t have a minibuffer, so we
  have to attempt to put the text in the pointer-documentation-pane
  (the black bar), but that approach is unreliable (the pane is
  refreshed very quickly by McCLIM itself). Also, the rectangular
  border around the &lt;tt&gt;(shot &quot;3.png&quot;)&lt;/tt&gt; is there because I have
  just clicked on the expression to re-evaluate it, but the screnshot
  was apparently taken before the presentation was inserted at the
  input area.
&lt;/li&gt;
&lt;li&gt;
  &lt;a href=&quot;http://sigkill.dk/athas/climdshots/4.png&quot;&gt;This
    screnshot&lt;/a&gt; is supposed to demonstrate CLIM&#039;s &quot;presentation
  history&quot; feature. Basically, I navigated backwards in the list of
  Beirc input. Most IRC-clients and command shells support this, but
  CLIM generalises it to be presentation-specific and relevant in
  every text-input context. So, for example, whenever an application
  asks me for a number, I can browse previous inputs of numbers (for
  that frame only, though). This doesn&#039;t yet work reliably in
  practice, but it&#039;s pretty nice &lt;em&gt;when&lt;/em&gt; it works.
&lt;/li&gt;
&lt;li&gt;
  &lt;a href=&quot;http://sigkill.dk/athas/climdshots/5.png&quot;&gt;On this
    screenshot&lt;/a&gt;, I have just run the Listener command &lt;tt&gt;Show Class
    Subclasses&lt;/tt&gt; with &lt;tt&gt;clim-stream-pane&lt;/tt&gt; as the
  argument. After that, I M-clicked on the &lt;tt&gt;DREI-GADGET-PANE&lt;/tt&gt;
  output and had the definition for it show up in the already-running
  editor. You can also M-click on commands and be taken to their
  definition, something that&#039;s actually pretty useful when hacking on
  CLIM applications.
&lt;/li&gt;
&lt;li&gt;
  &lt;a href=&quot;http://sigkill.dk/athas/climdshots/6.png&quot;&gt;This&lt;/a&gt; is what
  happens when you push your luck. I accidentally triggered a nasty
  X-LENGTH issue that (I think) has something to do with using
  McCLIM-Freetype, which caused McCLIM&#039;s connection to the X server to
  corrupt. It might have been recoverable, but I wasn&#039;t dropped into a
  debugger - probably because the debugger itself is a CLIM
  application. Interestingly, since the Eclipse window manager didn&#039;t
  use the same connection to the X server as McCLIM, I was able to
  conjure up an xterm and take the screenshot.
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;
  McCLIM does some cool things already, but it needs work - patches
  are, as always, welcome.
&lt;/p&gt;
 
    </content:encoded>

    <pubDate>Tue, 21 Nov 2006 13:25:18 +0100</pubDate>
    <guid isPermaLink="false">http://sigkill.dk/blog/archives/241-guid.html</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by-sa/2.5/</creativeCommons:license>
</item>
<item>
    <title>Library use in the Common Lisp community</title>
    <link>http://sigkill.dk/blog/archives/240-Library-use-in-the-Common-Lisp-community.html</link>
            <category>Lisp (EN)</category>
    
    <comments>http://sigkill.dk/blog/archives/240-Library-use-in-the-Common-Lisp-community.html#comments</comments>
    <wfw:comment>http://sigkill.dk/blog/wfwcomment.php?cid=240</wfw:comment>

    <slash:comments>7</slash:comments>
    <wfw:commentRss>http://sigkill.dk/blog/rss.php?version=2.0&amp;type=comments&amp;cid=240</wfw:commentRss>
    

    <author>nospam@example.com (Troels Henriksen)</author>
    <content:encoded>
    &lt;p&gt;
  I often get the impression that many in the Lisp community dislike
  library dependencies, and prefer to build as much as possible out of
  standard Common Lisp. I can understand why completely unrestrained
  addition of library dependencies can be a bad thing - the libraries
  may be buggy, unportable, hard to install or hardly accessible. The
  user might be annoyed at having to download and install a large
  amount of libraries in order to run some application. I don&#039;t mind
  Lisp systems that depend on portable, high-quality libraries (such
  as most of what &lt;a href=&quot;http://weitz.de/&quot;&gt;Edi Weitz&lt;/a&gt; writes),
  nor do I mind adding a dependency on those libraries to my code. I&#039;d
  much rather use something
  like &lt;a href=&quot;http://weitz.de/flexi-streams/&quot;&gt;FLEXI-STREAMS&lt;/a&gt;
  instead of hand-rolling my own encoding-handling code, even if I
  only end up using a fraction of the functionality of
  FLEXI-STREAMS. I also see parts of the functionality
  of &lt;a href=&quot;http://www.cliki.net/SPLIT-SEQUENCE&quot;&gt;SPLIT-SEQUENCE&lt;/a&gt;
  and &lt;a href=&quot;http://weitz.de/cl-ppcre/&quot;&gt;CL-PPCRE&lt;/a&gt; duplicated when
  needed, despite the fact that both of these libraries are of high
  quality and have good documentation. The performance difference
  between the use of one of these libraries and a hand-rolled piece of
  code is likely to be negligible, and a call
  to &lt;tt&gt;split-sequence:split-sequence&lt;/tt&gt; or using a regular
  expression with CL-PPCRE is also likely to be much easier to figure
  out for the reader of the code, as opposed to making the reader
  figure out some complex-looking &lt;tt&gt;do&lt;/tt&gt; or &lt;tt&gt;loop&lt;/tt&gt; form.
&lt;/p&gt;

&lt;p&gt;
  Even if using a library might technically be the right decision, it
  might not be in the context of the users of your application. A Lisp
  system that depends on a large amount of hard-to-install libraries,
  perhaps even some that must be retrieved from well-hidden source
  repositories, can be highly painful to install, and even a seasoned
  hacker might get annoyed with the whole thing and give
  up. Especially if one of the dependencies is a forked-CVS-version of
  a library that is not compatible with the library already installed
  (and used) by the user. In most modern operating systems,
  dependencies are no longer a serious problem - any reasonable
  package manager is capable of automatically downloading all the
  dependencies of a package, and installing them before installing the
  package itself. We have such a system in the Lisp world as well -
  &lt;a href=&quot;http://www.cliki.net/ASDF-Install&quot;&gt;ASDF-Install&lt;/a&gt;. While
  ASDF-Install certainly has its problems, it has worked very well for
  me when I just wanted to check out some cool application, and didn&#039;t
  want to bother with installing stuff manually. A good package system
  seems to be a core part of a modern software infrastructure, and it
  seems to be just the thing that makes usage of large quantities of
  libraries realistic, which is why I believe it is worth fixing the
  imperfections of ASDF-Install, or develop a replacement if the
  current design is insufficient (the use of Cliki as the database
  might not be such as good idea - perhaps
  something &lt;a href=&quot;http://common-lisp.net&quot;&gt;common-lisp.net&lt;/a&gt; or
  &lt;a href=&quot;http://cl-user.net&quot;&gt;cl-user.net&lt;/a&gt; based would be better?).
&lt;/p&gt;

&lt;p&gt;
  While I do not claim to be an expert on every software development
  ecology in the world, this dislike of libraries is something I have
  mostly encountered in the Lisp world. The programmers of other
  languages seem to embrace a large number of highly specialized
  utility libraries - perhaps because they have a well-working package
  management infrastructure in place (Perl CPAN or Ruby Gems, for
  example)? As a horribly meaningless data point, GNOME&#039;s standard
  editor, &lt;tt&gt;gedit&lt;/tt&gt;, is dynamically linked with &lt;em&gt;63&lt;/em&gt;
  libraries on my system, but because my package system has taken care
  of the dependencies, I do not really care - as a user, what matters
  is that &lt;tt&gt;gedit&lt;/tt&gt; has functionality, and if I were to hack on
  it, I would appreciate that I could use my knowledge of the standard
  libraries it uses, instead of having to figure out the
  implementation details of yet another general, yet custom-rolled,
  piece of functionality. Fortunately, not all Common Lisp projects
  seem to shy away from the use of libraries
  - &lt;a href=&quot;http://common-lisp.net/project/ucw/&quot;&gt;UnCommon Web&lt;/a&gt;,
  for example, seems to be created mostly as a shortcut for loading
  everything on common-lisp.net. I like using libraries - I want to
  write new stuff, not rewrite stuff written by thousands of
  programmers before me. I hope that I can find out why some Common
  Lisp hackers dislike dependencies on larger sets of libraries, and
  either fix the problems, or be enlightened as to why dependencies
  are a Bad Thing.
&lt;/p&gt;
 
    </content:encoded>

    <pubDate>Fri, 17 Nov 2006 23:21:13 +0100</pubDate>
    <guid isPermaLink="false">http://sigkill.dk/blog/archives/240-guid.html</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by-sa/2.5/</creativeCommons:license>
</item>
<item>
    <title>McCLIM 0.9.3 &quot;All Souls Day&quot;</title>
    <link>http://sigkill.dk/blog/archives/236-McCLIM-0.9.3-All-Souls-Day.html</link>
            <category>Lisp (EN)</category>
    
    <comments>http://sigkill.dk/blog/archives/236-McCLIM-0.9.3-All-Souls-Day.html#comments</comments>
    <wfw:comment>http://sigkill.dk/blog/wfwcomment.php?cid=236</wfw:comment>

    <slash:comments>0</slash:comments>
    <wfw:commentRss>http://sigkill.dk/blog/rss.php?version=2.0&amp;type=comments&amp;cid=236</wfw:commentRss>
    

    <author>nospam@example.com (Troels Henriksen)</author>
    <content:encoded>
    &lt;p&gt;
  Thanks to tireless Release Engineer Andreas Fuchs, McCLIM version
  0.9.3 has been released! I was about to write a blog entry about how
  this was a release short on shiny features, and that it mostly had
  solid bugfixes and changes of that sort. But as I have already
  &lt;a
  href=&quot;http://www.lispniks.com/pipermail/gardeners/2006-October/001600.html&quot;&gt;
  used up my quota of unsubstantiated claims for this week&lt;/a&gt;, I
  decided to check the list of changes, just to be sure, which
  resulted in me being reminded that this release actually has some
  pretty major additions. The most shiny new feature is
  probably &lt;a
  href=&quot;http://mcclim.cliki.net/Using%20the%20McCLIM%20gtkairo%20backend%20on%20sbcl%200.9.13&quot;&gt;Gtkairo&lt;/a&gt;
  - a new backend using GTK widgets
  and &lt;a href=&quot;http://cairographics.org/introduction&quot;&gt;Cairo&lt;/a&gt; for
  drawing. It&#039;s not yet as functional as the default CLX backend, but
  it presents the interesting future prospect of McCLIM applications
  not being as ugly as they are now. Also, using high-level Cairo
  drawing primitives easily beats raw X drawing for
  convenience. Personally, the McCLIM change I find most
  interesting is that Andreas Fuchs removed a nasty memory leak in the
  incremental redisplay code, that would eventually cause applications
  using incremental redisplay to gobble up all available memory. This
  means
  that &lt;a href=&quot;http://common-lisp.net/project/climacs&quot;&gt;Climacs&lt;/a&gt;
  will now run for more than ten minutes before getting unusably slow
  due to constant large-scale garbage collections! (It&#039;s still slow,
  but at least it no longer degrades even further with use.)
&lt;/p&gt;

&lt;p&gt;
  Also, making the freeze period so short (McCLIM
  was &lt;a
  href=&quot;http://boinkor.net/archives/2006/10/mcclim_frozen_again.html&quot;&gt;frozen&lt;/a&gt;
  last saturday) seems to work much better than long freeze periods
  that eventually just fizzle out. I doubt freeze periods cause the
  McCLIM hackers to start testing obsessively anyway, so the primary
  motivation and goal for the freeze period should be to make sure
  that no-one will commit any experimental buggy code just before a
  release.
&lt;/p&gt;

&lt;p&gt;
  McCLIM 0.9.3 probably works best on a threaded SBCL, and doesn&#039;t
  work on CMUCL and CLISP. The reason for the CMUCL breakage is the
  lack of proper support for forward-referenced classes in CMUCL&#039;s
  CLOS implementation, but that has been fixed in very-recent CMUCLs,
  so you might be able to find a patch so you can run McCLIM (it&#039;s
  fixed in 19d patch1 I&#039;m told). The reason for the CLISP breakage is
  somewhat similar - CLISP chokes when compiling certain files that
  contain function definitions in whose body can be found a form
  resembling &lt;tt&gt;(typep x &#039;foo)&lt;/tt&gt;, where &lt;tt&gt;foo&lt;/tt&gt; is the name
  of a class that has not yet been defined. I have not yet been able
  to create a small test case for demonstrating this, but CLISP
  hackers are most welcome to look at the issue by compiling McCLIM. I
  had an idea about how to create a hack that defined stub classes in
  advance, but for some reason CLISP suddenly compiles McCLIM without
  problems on my system, so I&#039;m unable to get a list of the affected
  classes. You might be just as lucky. No matter what, remember that
  your CLISP will need to use MIT-CLX, NEW-CLX is known not to work.
&lt;/p&gt;
 
    </content:encoded>

    <pubDate>Thu, 02 Nov 2006 20:14:11 +0100</pubDate>
    <guid isPermaLink="false">http://sigkill.dk/blog/archives/236-guid.html</guid>
    <creativeCommons:license>http://creativecommons.org/licenses/by-sa/2.5/</creativeCommons:license>
</item>

</channel>
</rss>