Proposed Extensions To ANSI
This page is for proposed incremental changes and extensions to the language that go beyond what would be appropriate for Proposed ANSI Revisions and Clarifications, but not as radical as changes in Lisp - Next Generation:
  • Changes to ANSI that are technically extensions, but address long-absent functionality which makes it difficult to portably do simple things.
  • Extensions that cannot be reasonably implemented as libraries. (Note: this makes FFI technically in scope, but unless a high-quality spec materializes there's no need to mention it...)
  • Extensions that can be implemented as libraries, but are very much standard folklore, like with-gensyms.

CDR is one process for publishing proposed extensions.

For user-space extensions, go and write a library.

  • Gray streams user-extensible streams

  • simple-streams from Franz, which avoid some problems in Gray streams

  • User-extensible sequences. See Christophe Rhodes' presentation from ILC 2007: http://www.doc.gold.ac.uk/~mas01cr/talks/2007-04-03%20Cambridge/ilc-talk.pdf.

    From the paper, it seems like the protocol relies on CLOS in a way that makes this impossible to support structures in addition to classes. Which, for example, prevents SERIES in its present form from being upgraded to a user-defined sequence. Even though anything implemented as a structure can be ported to CLOS, I believe it's worth pointing out, since structures can be expected to be more efficient in general. — akater

  • Case-sensitive symbols. ACL and CLISP both have extensions to provide this (see https://franz.com/support/documentation/current/doc/case.htm and https://clisp.sourceforge.io/impnotes/package-case.html)

  • Add conformal displacement (array slices) for multidimensional arrays. The other side of the argument is to get rid of displaced arrays altogether, since they are rarely used and prevent certain optimizations. --Vladimir Sedach

  • Extend ARRAY, VECTOR, STRING, and related type specifiers so that other array attributes can be specified (that the object is/is not displaced, adjustable, or (for vectors) it does/does not have a fill pointer.)

  • Add weak-key hashtables for example by standardizing on the extensions of Franz or Lispworks. trivial-garbage is a library that attempts to provide a portable interface to various implementations' weak hashtables. Weak-value hashtables and weak references should also be included. Finalizers are a very important feature. The extension should specify whether the finalizer can have access to the about-to-be-collected object to be able to "resurrect" it (currently some GCs run finalizers post-collection; the pros and cons of either approach should be examined). See Bruno Haible's writeup on weak references which examines the issues and state of various implementations as of 2005.

  • Have a way to weakly intern symbols in a package. The effect is that if nothing else refers to the symbol, the symbol can be gc-ed and removed from the package. Alternatively, allow gc of every unreferenced truly worthless symbol (that is, one on which BOUNDP, FBOUNDP, and SYMBOL-PLIST all return NIL) --John Cowan

  • Make WITH-GENSYMS or WITH-UNIQUE-NAMES macro part of the standard, since it is very widely re-implemented in libraries.

  • Specify, for lisps purporting to conform to :IEEE-FLOATING-POINT, the mechanism for enabling traps and clearing accrued exceptions, and for setting the rounding mode (and precision, where applicable), and how this interacts with standard CL functions such as FFLOOR and FCEILING.

  • Improve the support for floating-point and complex arithmetic as outlined in section C.9 of the draft version of ISO/IEC 10967-2 and section C.7 of the draft version of ISO/IEC CD 10967-3. (There may be other standards from ISO/IEC JTC1/SC22/WG11 that could be made normative.)

  • Add an ARGLIST function that, given a function designator, returns the argument list of the function. Suggested alternative name: FUNCTION-LAMBDA-LIST.

  • Define a way for macros to wrap a LOOP around the body without affecting LOOP-FINISH forms within it. This could be done by defining a new LOOP keyword FINISH-NAME. Then, (loop ... do (loop finish-name foo ... do (loop-finish))) would finish the outer loop directly. To finish just the inner loop, you'd have to use (loop-finish foo). Macros would use gensyms.

    Other possible syntaxes include (loop using (loop-finish foo) ...), which puns on for-as-hash; (loop unfinishable ...), which would be entirely invisible to LOOP-FINISH; and (loop fully named foo ...), which would require both (return-from foo ...) and (loop-finish foo).

    Would extending LOOP-FINISH to take the loop name as an argument be sufficient (exit from the innermost loop with the given name)? --Nikodemus Not quite. Users of macros would often omit the argument of LOOP-FINISH, for the sake of clarity or compatibility with current CL. Implementors of macros would not be able to handle such cases transparently. If LOOP is extended too, then only macro implementors need be careful, like they already are with names of variables; users can ignore the whole issue. -Kalle Olavi Niemitalo

    I don't understand the need for this. However, LOOP already has a NAMED clause that could be used for LOOP-FINISH. It would overload its meaning, but it would reduce the number of changes needed. - Marco Antoniotti

  • (backquote ...) standard macro (like Scheme quasiquote) to allow for easier and scheme-like programmatic use of ` in constructs. I forget any arguments as to why it standardising it would not be good idea, but no doubt there are some. Constraining implementations seems unlikely as far as I can see. Morality-police discouraging its use, maybe, but I don't like that.

    If the semantics are going to match Scheme, then the name should too. Also, one cannot implement extensions such as `#C(,x ,y) if the ` reader macro is required to just read a form and put (backquote ...) around it. -Kalle Olavi Niemitalo

    Is that really so? I would think that changing #C to translate #C(,x ,y) to (unquote (complex x y)) would do the trick. -Dirk Gerrits

    This is a really, really bad idea; totally contrary to the meaning of backquote. Backquoted material should be handled by the reader (as in most CL implementations now). Turning it into a form is so bad, I'd seriously consider abandoning Lisp if it happened, I feel so strongly about that. -- AC

    No, it's a good idea. While most of the times it doesn't matter whether backquote is handled in the reader or not, there are times when it'd be really nice to know what the sexpression representation of '`(foo ,bar) is. Currently it's implementation defined which means that macro-writing macros can't take backquoted templates as input which they can then frob. A specific example: recently I was writing a mini-language and wanted to write two functions, one that compiled my intermediate representation for use in a macro and another that interpreted it. The compiler and interpreter were essentially identical except one generated code while the other executed it. If backquote templates were read into a specified sexpression form then I could have written a macro that took a list of backquoted templates and generated both functions. Instead I had to essentially implement my own backquote syntax that I could then take apart and put back together. -- Peter Seibel

    I don't claim to have thought this through, but requiring tighter binding of backquote/comma to the reader might let constructions such as #C`(,a ,b) fall out without extra per-read-macro specifications. --nikodemus

  • Extend MAKE-HASH-TABLE to take any function as an equality predicate, and open it up so users can write their own hash functions. These will put CLOS objects on an equal footing with built-in objects.

    I'd rather see (DEFINE-HASH-TABLE-TEST test-function-name hash-function-designator), and making MAKE-HASH-TABLE accept any defined test in addition to #'eq.*. This way libraries can provide new hash-table types, and users of those libraries don't need to muck about with extra arguments to M-H-T. --Nikodemus --Why not test-function-designator, then? --John Cowan

    I like DEFINE-HASH-TABLE-TEST too. --sds

  • Extend the guaranteed behavior of SUBTYPEP, so that it must succeed in determining subtype relationships in more situations. In particular:
    • If SUBTYPEP can determine that A is (or is not) a subtype of B, then it should determine that (NOT B) is (is not) a subtype of (NOT A).
    • (NOT (NOT A)) should have the same behavior as A.
    • If SUBTYPEP can determine that A is a subtype of B, and A is a subtype of C, then it should be able to determine that A is a subtype of (AND B C).
    • If SUBTYPEP can determine that A is a subtype of C, and B is a subtype of C, then it should be able to determine that (OR A B) is a subtype of C.
    • Better yet, require SUBTYPEP to succeed in all situations except those involving SATISFIES (which are undecidable), per Henry Baker's decision algorithm. --John Cowan
  • Make more builtins be readably printable in some standard way. Alternately, allow users to define PRINT-OBJECT methods for builtin types on which the implementation does not provide a method.
  • Add an ELASTIC-NEWLINE function.
  • Franz's first-class environments proposal.

  • Eliminate holes in standardized exceptional situations (where the standard says something is undefined for certain arguments, etc.). The goal should be that safe code does not have undefined behaviors on erroneous arguments, since any such is a potential security hole.

  • A function to expand user-defined types into primitives. Does this mean a function that takes a type specifier and returns something implementation-specific? Or something else? I don't understand this or why it's needed. --Vladimir Sedach

  • Ability to efficiently list all specified readtable characters/dispatch-characters.

  • Custom CLOS specializers without rewriting that much of standard-class. How would this work? --Vladimir Sedach

  • Reader syntax for hash tables.

  • Turn COERCE into a generic function.

  • Add readers RESTART-TEST-FUNCTION, RESTART-INTERACTIVE-FUNCTION, RESTART-REPORT-FUNCTION, which will act analogous to RESTART-NAME. This will make the existing condition system introspection facilities (COMPUTE-RESTARTS and FIND-RESTART) more useful.

  • Add function SIGNALED-CONDITION to make the currently signaled condition easily accessible within restarts.

  • Add a dual to COMPUTE-RESTARTS that, given a restart, will return a list of the conditions currently associated with that restart (see CLHS section 9.1.4.2.4 Associating a Restart with a Condition: "A single restart may be associated with several conditions at the same time.")

  • Add an analogue of PROGV for RESTART-CASE. That is, make it possible to use the result of FIND-RESTART or COMPUTE-RESTARTS to introduce restart handlers in the current dynamic environment. Right now this is possible by constructing a RESTART-CASE expression based on examining restarts, and applying EVAL to that expression. This would extend the introspection facilities of the condition system.

  • Provide access to SAFETY OPTIMIZE declarations during macroexpansion time ala the Environments chapter of CLtL2. This will make it more convenient to write optimized code with optional type checks/assertions.

  • A standard way to figure out whether a setf expander has been defined (via either DEFSETF or DEFINE-SETF-EXPANDER) for a symbol FOO . See this mailing list thread for why this is problematic to do with GET-SETF-EXPANSION.

  • Extend the definition of NTHCDR to be an accessor, like NTH. Specify that (SETF (NTHCDR index place) value-form) is equivalent to (SETF place value-form) when index is = to 0, except for side-effects in the evaluation of index. This makes it possible to insert into any position in a list with (PUSH element (NTHCDR index list)), and extract an element in any position with (POP (NTHCDR index list)). List insertion/extraction operations are a conspicuous deficiency of the Common Lisp standard; functions such as REPLACE, that might be expected to support insertion, do not.

  • Amend 5.1.2 Kinds of Places to add IF as a kind of place. Specify that (SETF (IF conditional consequent-place alternative-place) value-form) performs the side-effects in the taken branch only: this can be implemented by a setf-expander that establishes bindings for the temporaries and store variables of both places, and sets them to be "active" under control of conditional. (Jean-Philippe Paradis remarks: I can't think of sane semantics for (setf if). See with-resolved-places for a more general mechanism.) (Response: I don't think the semantics are that difficult. Anyway, this is required to be able to use macros or symbol macros that expand into IF expressions as SETF places: see 5.1.2.7 and 5.1.2.8. Using such macros as places is a reasonable thing to do.)


standards