[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
possible.
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).
http://www.cs.dartmouth.edu/~doug/
For those who don't know Doug McIlroy, suffice it to say he knows what
he is talking about :-)
http://osdir.com/ml/lang.haskell.hugs.user/2006-01/msg00006.html
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
translator.
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
- gcl, shared libraries, was [Axiom-developer] Lisp portability, Camm Maguire, 2007/05/23
- Re: gcl, shared libraries, was [Axiom-developer] Lisp portability, Gernot Hueber, 2007/05/23
- [Axiom-developer] Re: gcl, shared libraries, C Y, 2007/05/23
- [Axiom-developer] Re: gcl, shared libraries, Camm Maguire, 2007/05/23
- Re: [Axiom-developer] Re: gcl, shared libraries, Gabriel Dos Reis, 2007/05/23
- [Axiom-developer] Re: gcl, shared libraries, C Y, 2007/05/23
- Lisp/TeX/TeXmacs was: Re: [Axiom-developer] Re: gcl, shared libraries, Ralf Hemmecke, 2007/05/24
- Re: [Texmacs-dev] Lisp/TeX/TeXmacs was: Re: [Axiom-developer] Re: gcl, shared libraries, Henri Lesourd, 2007/05/27
Re: gcl, shared libraries, was [Axiom-developer] Lisp portability,
Gabriel Dos Reis <=
Re: gcl, shared libraries, was [Axiom-developer] Lisp portability, Gabriel Dos Reis, 2007/05/23
Re: gcl, shared libraries, was [Axiom-developer] Lisp portability, Waldek Hebisch, 2007/05/24