[asdf-devel] source file encoding

Faré fahree at gmail.com
Sun Apr 15 01:00:08 UTC 2012


On Fri, Apr 13, 2012 at 02:44, Douglas Crosher <dtc-asdf at scieneer.com> wrote:
> The only practical solution seems to be to detect the encoding from the file.
> I could write portable code for ASDF to read an ASCII header line
> and look for encoding declarations, and handle a few common headers
> (emacs has 'coding', LispWorks seems to use 'encoding' or 'external-format').
> Auto-detection could handle some of the common codings,
> but could be a big chunk of code.
> The quicklisp project may be prepared to patch in headers
> to system definition file using non-ASCII encodings,
> and this could be largely automated.
>
Yes, this is a valid approach, though it is somewhat heavy in coding
and will grow ASDF by a few hundred more lines of code.
Don't forget to support the way Emacs detects encoding, etc.
It is certainly more than I am willing to code,
and making the semantics of loading more complex than I am comfortable with.
Before you code it yourself,
I'd like to hear about other users here what they think.

An additional small thing I don't like about the approach is that
you have to open a file twice, once to detect encoding,
the other time to load or compile-file it, which is not atomic
and can be slightly nasty (if e.g. the file is actually a URL or
mounted on a weird filesystem or whatnot).
But that's secondary.

Also, I'm not sure how big the market for such support is.
There again, I'd like to hear from potential users.


> If infrastructure is added for the system definition files
> then it would be only a small step to also use this for the lisp source files.
Indeed.

Alternatively, this could be an :automatic mode added to asdf-encodings,
rather than a part of ASDF itself, at which point it would be available
to source files, but not system files.

> Lispworks appears to be able to automatically detect file coding, and
> it would be interesting to know if the ASDF encoding problems
> are not an issue for LispWorks users?   If so then this would appear to add more support to making the default :default.
> http://www.lispworks.com/documentation/lw61/LW/html/lw-659.htm#39723
>
If you want your code to be portable, you can't rely on users using LispWorks.
Deterministic well-defined semantics require that the meaning of your code
should not depend on magic that may or may not happen.


PS: This long discussion on a relatively minor topic reminds me of
Parkinson's Law of Triviality. What color should the bikeshed be painted?

—♯ƒ • François-René ÐVB Rideau •Reflection&Cybernethics• http://fare.tunes.org
Classical Liberalism: the only truly subversive ideology.




More information about the asdf-devel mailing list