Recent support questions of general interest

Documenting a large and complicated product like Allegro CL is never easy and even conscientious users often have difficulty finding answers to specific questions in the documentation. In this note, we flag some recent support questions which might be of general interest.

This note is for our Lisp, not for our database products like AllegroGraph and AllegroCache.

How do I run a bat file from within lisp?


(run-shell-command "cmd /c foo.bat" :show-window :hide)

The function run-shell-command looks very complicated because it has lots of options, but doing simple things is often easy. Also many OS commands can be run using the specialized Operating System Interface functions.

How do I run a top-level command like :cd from within a function?


(tpl:do-command :cd "new-dir-path/")

tpl:do-command is the functional interface to top-level commands.

How can I increase the number of characters printed on a line?


The variable cl:*print-right-margin* controls how many characters are printed on a line. This initial value is nil, which means determine how many will fit and print that many, but the value can be set to any integer.

I used :external instead of :external-format (the correct argument) in a call to open. Why wasn't an error signaled?


Our problem is this: streams in ACL are implemented as instances of CLOS classes, and any class can have any initargs we or the user chooses to define. open does some setup and then calls make-instance with the arguments passed to open. There is no way for open to know which argument/value pair is valid or not.

make-instance could check for validity of initargs but this is expensive and doing so would slow down stream creation significantly (and slow it down for every stream created, so all correct code would also run more slowly). In choosing between evils, we have chosen what we believe to the the lesser. (See this section of implementation.htm for details of the implementation of open.)

How do I tell if a socket is closed?


A socket is just a stream, so you can use cl:open-stream-p to tell whether it is opened or closed. Note that a true value says it is open but cannot be wholly trusted: even in a non-multiprocessing environment an open stream to an outside device can be closed for reasons external to Lisp and in a multiprocessing environment, another process can close a stream between the call to open-stream-p and an attempt to access, so for total safety, you can wrap the write/read in an error handler which will act appropriately if there is a write/read failure.

If I do a 'mlisp -L filename' without providing the extension, which of the .cl and the .fasl file is loaded?


As with load, -L loads the fasl file if present. It calls load which works as usual, behaving as specified by sys:*load-search-list*, so if you have modified the value of that variable in the image, the behavior will follow the modification.

decode-universal-time gives a date December 32, 1941


This was obviously a bug and was fixed by a patch released soon after the report. The date was 1/1/1942 and the locale was Czechoslovakia which had year-round daylight saving time that year. The bug was caused by an unnoticed assumption that it was never daylight saving time on December 31 or January 1. We mention this (now fixed) problem to remind people that however much testing you do, some cases will slip by and be discovered in the field.

Copyright © 2019 Franz Inc., All Rights Reserved | Privacy Statement Twitter Google+