[asdf-devel] Make the CL syntax predictable

Faré fahree at gmail.com
Thu Mar 27 17:06:08 UTC 2014


On Thu, Mar 27, 2014 at 12:30 PM, Robert Goldman <rpgoldman at sift.net> wrote:
> Zach Beane wrote:
>> Faré <fahree at gmail.com> writes:
>>
>>> femlisp raises an interesting issue: it has (setq
>>> *READ-DEFAULT-FLOAT-FORMAT* 'double-float) in setup.lisp, which is
>>> cancelled by the with-standard-io-syntax that I introduce in my
>>> syntax-control branch. I just pushed a change in said branch to make
>>> the 'double-float the default in with-asdf-syntax, which I believe is
>>> a more useful convention than what the standard provides.
>>
>> I don't like the idea of ASDF setting a different
>> *READ-DEFAULT-FLOAT-FORMAT* value during ASDF operations than it will
>> have in the REPL, during plain loading, or compile+loading individual
>> files outside of ASDF.
>>
>> Zach
>>
>
> I second this dispreference.  As an old-school lisper, used to working extensively on incremental development in the editor buffer, and even in the REPL, this seems bad to me.  The errors it will lead to will be odd corner cases, bewildering to ordinary programmers not versed in the fussy details of ASDF implementation.  Put yourself in such a programmer's shoes, when his/her code that worked fine in the repl breaks in ASDF, or vice versa.  What's the debugging process?
>
> Maybe the default is undesirable, but it's not our job to patch all the undesirable features of Common Lisp.
>
> The more divergences between CL-in-ASDF and CL that are introduced in this branch, the more likely it is that it will have to live on as a permanent fork and not be merged.
>
I also have this preference, but I slightly disagree on how to resolve it.

femlisp side-effects *READ-DEFAULT-FLOAT-FORMAT*, which means that
every system compiled after it will be treated differently than if it
were compiled before it — and once again, whoever writes the system
does not and cannot control the order in which things are compiled,
which ultimately depends on what toplevel system the user operates on
and what systems have or haven't already been compiled (and are up to
date) before he operates on that toplevel system. This means that the
semantics of your system are already dependent not just on the REPL
but also other uncontrolled and uncontrollable state. This is not
desirable.

In effect, when you write 1.0 instead of 1.0f0 or 1.0d0 in a file,
you're currently saying "it's OK to compile with single-float and
double-float alike". Thus, ASDF binding *READ-DEFAULT-FLOAT-FORMAT* to
either value (1) is not breaking any previous contract, and (2) is
making things more deterministic, hence better. And double-float is a
generally more useful choice than single-float in this context, not
just for femlisp, but for all newbies who don't expect precision loss,
etc.

My solution would be to (setf *read-default-float-format*
'double-float) as part of loading ASDF, just like we (setf
*print-readably* nil) for the sake of Allegro, just like we change the
package to ASDF-USER before loading an .asd file, etc. Then, the REPL
and ASDF still agree by default, and the user is responsible if he
makes them disagree, and the library authors don't have to worry what
the user uses. Note that :around-compile hooks and other :around
methods already make compiling via ASDF different from just calling
compile-file. Note that swank-asdf already has an option (unhappily,
disabled by default) to not call compile-file but use asdf:compile-op
on C-c C-k. It unhappily doesn't do anything at all for C-c C-c, and
that would be a trickier thing to fix, especially if the around
wrapper changes the readtable (you'd have to call that), or if it
enforces a file-granular invariant that locally broken by individual
forms (you'd have to not call that).

—♯ƒ • François-René ÐVB Rideau •Reflection&Cybernethics• http://fare.tunes.org
The trouble with opportunity is that it always comes disguised as hard work.
                — Herbert V. Prochnow



More information about the asdf-devel mailing list