[Openmcl-devel] Best practice for writing a loader (def-pathname blues)
peter.braroe at newsmachine.com
Thu Jan 19 08:28:26 PST 2006
Thanks a lot!
Worked fine - now I need to get into the nitty gritty of porting to a modern
lisp... I am hoping to get plenty of time this weekend!
Peter A. Braroe
S-116 62 Stockholm
Office: +46-(0)8-442 03 31
Mobile: +46-(0)708-750 991
Från: Gary Byers [mailto:gb at clozure.com]
Skickat: den 16 januari 2006 12:30
Till: Peter Braroe
Kopia: 'openmcl-devel Devel'
Ämne: Re: [Openmcl-devel] Best practice for writing a loader (def-pathname
On Mon, 16 Jan 2006, Peter Braroe wrote:
> Hi all!
> Thus is a oldbie post: I am trying to write a loader for a small project
> work. I looked at some old code (written for Allegro CL 1.22! :-) that
There was a period (in the late 80s) where what is now known known as MCL
was marketed as "Macintosh Allegro Common Lisp", though that never had
anything to do with Franz's Allegro CL product. Eventually, the people
who thought that this made some sense realized that it didn't; I assume
that the old code you was "MACL"-specifoc.
> (def-logical-pathname "path" "Machintosh HD:MyDir")
This would have also been in the timeframe before ANSI CL added logical
pathnames. MACL/MCL offered a simpler facility in those days; despite
the similar name, it had little to do with CL logical pathnames.
MACL also used (and, AFAIK, MCL still uses) HFS-based syntax to refer
to physical pathnames (e.g, pathname components separated by colons,
with a physical volume name as the first component of an absolute
pathname.) OpenMCL uses Unix/POSIX syntax, where forward slashes
separate pathname components and an absolute pathname starts with
a forward slash. If the OSX boot volume was named "Macintosh HD",
the absolute pathname of the MyDir subdirectory of the volume would
> And then
> (load "path;myfile")
> However this does not seem to work these days!
I doubt if it's worked since about 1991 or 1992.
> Question: What is the correct "best practice" way to write a loader today?
> Anyone have some elegant example code out there?
> I found some uses of (make-pathname ... ) but is that the way to go?
ANSI CL's logical pathnames are both more powerful/flexible than the old
MCL facility was and more complicated. The typical idiom involves
defining a "logical host" and defining translation rules which map
logical pathnames that have that host component to physical pathnames.
? (setf (logical-pathname-translations "path")
This allows (for instance) the logical pathname
to be used to refer to the file #p/MyDir/subdir/foo.lisp".
> The make-pathname command seems to stipulate that one defines the filetype
> also and what if I want to load other files containing data from the same
> directory - do I have to define two pathnames then?
> And what about packages - do I need to define which package a file belongs
> to in every file (like java)?
> And if I use packages do I always need to do export/use-package and such
> be able to call my functions(methods)
> Hope this makes sense to someone and that this is not too annoyingly
> It's always amusing too see when doing something new that the difficult
> stuff is best documented and the easy big picture stuff (that one always
> clueless about) is hard to find answers too!
There are good Common Lisp tutorials freely available.
See (for example):
OpenMCL intentionally deviates from the ANSI CL spec in one
pathname-related way; the spec says (for instance) that logical
pathname components are maintained in upper case and (usually) mapped
to the "preferred case" of the underlying filesystem on translation.
I don't know of any filesystems in widespread use today for which the
concept of "preferred case" has meaning, and there are certainly
filesystems in widespread use today which are case-sensitive; OpenMCL
ordinarily preserves the case of logical logical pathname components
during both logical pathname parsing and translation.
> Thanks beforehand all!
> Openmcl-devel mailing list
> Openmcl-devel at clozure.com
More information about the Openmcl-devel