[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: gcl, shared libraries, was [Axiom-developer] Lisp portability

From: Gabriel Dos Reis
Subject: Re: gcl, shared libraries, was [Axiom-developer] Lisp portability
Date: 23 May 2007 18:42:37 -0500

Camm Maguire <address@hidden> writes:


| > directories -- to gain portability between Unix and Windows
| > I tried to use Lisp code.  But each Lisp is doing them
| > differently (and apparently some operations sometimes are missing).
| > So I got a maze of conditionals over Lisp implementations.
| > Looking at resulting code I feel that it is better to
| > call operationg system utilities and have just use 
| > conditionals to choose between Unix and Windows versions
| > of file utilities.
| In C, we call this #ifdef hell.  There is no good reason for it, in my
| experience. 

Fully agreed.  

Some of us would like to see Cpp disappear, but after spending time
and resources thinking of it, I don't see how to make it disappear in
the immediate future.  The best I can offer is to avoid it as much as

If that can be of any consolation, I would like to offer this message
from Doug McIlroy on Cpp and similar stone-age constructs (when some
people suggested its inclusion in Haskell).  

For those who don't know Doug McIlroy, suffice it to say he knows what
he is talking about :-)

     A recent posting that expressed a desire for #ifdef struck
     me as perverse.  A prime reason for using Haskell is its
     elegance and clarity.  To adopt the most inelegant and
     turgid feature from C would be like encouraging graffiti
     in a museum.

     Most #ifdef's and #if's memorialize failures of imagination
     or care, often in the name of "portability".  Code is
     NOT portable if it has to be rewritten according to the
     conventions of each environment.  Ifdef expresses just such
     rewriting, and in an egregious style: it inverts the
     logical structure of a program, bringing the tweaks to
     the top while fragmenting the real architecture.

     To make code portable, one should first get rid of system
     dependencies to the greatest extent possible.  Then treat
     the recalcitrant residue with the same sense of style as
     any other programming task.

     Some standard methods that apply everywhere in programming
     are equally helpful for portability:

        Modularization (sweeping systemisms into a corner)
        Generalization (rising above the systemisms)

     For dealing with the recalcitrant residue, a method that
     Haskellites should find specially sympathetic is

         Specialization (freezing certain parameter values)

     Ifdef, if course, is a specialization technique, but from
     another era.  If there really is a need for specialization,
     it would be far better to employ a Ershovian specializer
     that creates Haskell from Haskell rather than from
     stone-age idioms.  Is one available?

     Doug McIlroy

What Doug says holds for Axiom word for word.  An Ershovian
specializer exists for Lisp as used by Axiom: It is the Boot

It strikes as very disturbing that Axiomatizers would like to convert
people into thinking mathematically about software and yet would fail
to apply those same systematic thinkings to the programs they write;
and in particular would consider that long list of #+ and #- is a good
way to structure programs.

-- Gaby

reply via email to

[Prev in Thread] Current Thread [Next in Thread]