Subject: Re: Using "internal" macros of a CL implementation
From: (Rob Warnock)
Date: Sun, 29 Oct 2006 21:12:55 -0600
Newsgroups: comp.lang.lisp
Message-ID: <>
Pascal Costanza  <> wrote:
| Victor Kryukov wrote:
| > my question was how one can possibly access such macros
| > (even in non-portable way) to avoid duplicating existing functionality.
| In a portable way: Create your own package with a low-level API. Make 
| sure that the API is close to at least one or ore existing low-level 
| APIs. Then you can provide different implementations depending on each 
| implementation, and in some implementations simply make the existing one 
| available through your own package. There exist numerous compatibility 
| layers that do it like this, like ACL-Compat, LW-Compat, 
| trivial-garbage, Closer to MOP, and various others. (For example, CLiki 
| has a page for such compatibility layers.)

Victor, here's a classic example of what Pascal's talking about:

    ;;; GETENV -- Mostly-portable code for accessing Unix
    ;;; (or Windows?) environment variables. Morphed very slightly
    ;;; from <URL:>
    ;;; Copyright (c) 2002 The Common Lisp Cookbook Project 
    ;;; See: <URL:>
    (defun getenv (name &optional default)
       #+CMU (cdr (assoc name ext:*environment-list* :test #'string=))
       #+Allegro (sys:getenv name)
       #+CLISP (ext:getenv name)
       #+ECL (si:getenv name)
       #+SBCL (sb-unix::posix-getenv name)
       #+LISPWORKS (lispworks:environment-variable name)


Rob Warnock			<>
627 26th Avenue			<URL:>
San Mateo, CA 94403		(650)572-2607