Package trivial-features

trivial-features ensures consistent *features* across multiple Common Lisp implementations.

About This Package



For example, on MacOS X platforms, while most Lisps push :DARWIN to *features*, CLISP and Allegro push :MACOS and :MACOSX instead, respectively. Some Lisps might not push any feature suggesting MacOS X at all. trivial-features will make sure all Lisps will have :DARWIN in the *features* list when running on MacOS X. This way, you can write
  #+darwin foo #-darwin bar     
instead of
  #+(or darwin macos macosx) foo
  #-(or darwin macos macosx) bar     
The section Specification describes the set of symbols that should or should not be present in cl:*features* on certain circumstances. This specification is implemented by the trivial-features system which supports a handful of Lisps.

The test suite is, in effect, an implementation using CFFI that is checked against the various implementations in src/tf-*.lisp.

trivial-features is MIT-licenced.



This is a first draft of a description of what symbols should be present in cl:*features* for various platforms. A possible future direction of this documentation might be a CDR - Common Lisp Document Repository document, if it turns out to be a good idea. (Making the language of this document much more precise will be necessary then.)

We will start by limiting ourselves to OS, CPU and endianness features on Windows and POSIX platforms.

There are various possible implementation strategies ranging from null implementations (when the host Lisp already pushes the wanted feature) to using FFI (e. g. calling uname() to grab system information.

Either :LITTLE-ENDIAN or :BIG-ENDIAN should present in *FEATURES*. For the time being, we will not concern ourselves with other orderings, switchable endianness, etc.
On Windows, :WINDOWS should be present in *features*.

On POSIX systems, the "sysname" information from uname(3) should be used to push the appropriate symbol to *features* by upcasing that string (or downcasing for the "modern" lisps) and interning it in the keyword package.



For convenience, :UNIX should be pushed when running on POSIX/UNIX-like operating system (that doesn't include Windows) and :BSD should be present when running on BSD-based systems (that includes Darwin)
These features should be mutually exclusive:



It is debatable whether :X86 shouldn't also be exported on x86-64, and :PPC on ppc64. SBCL doesn't. Other ways to handle, for example, the x86/x86-64 case would be to export something like :PC386 in both cases or have an additional :X86-32. Or finally, have just :X86, :PPC, etc, and add :32-BIT-CPU and :64-BIT-CPU features.


Common Lisp Hyperspec (TM): Variable *FEATURES*
Maintaining Portable Lisp Programs, by Christophe Rhodes, February 5, 2004

Exported Symbol Index