This is just a curt supplement to Faré's answer.  (Hopefully I won't be
bothered anymore by common-lisp.net antispam machinery.)

> Is there some reason why we must put the external-format into the
> property list instead of just giving it a slot in the component class
> definition?

It was my ignorance.

> Also, what sort of an entity are the external format values?  Is it
> always a keyword symbol?  Can we say that it should always be a keyword
> and that we will massage it to something else, if necessary, for the
> benefit of the implementation when reading a file?

Maybe yes.  Consider that e.g. some implementations accept more options
(mostly to control line terminators) — CLISP as instances of
ext:encoding, LispWorks as lists like '(:latin-1 :eol-style :lf); but
then CLISP explicitly says that line terminators don't matter during
input.

> In that case we could have an accessor that will do the
> implementation-specific massaging for us (e.g., we could store :utf-8,
> but on clisp we would present charset:utf-8 when reading...).  That
> seems somehow tidier to me, rather than changing the value behind the
> programmer's back as we do here.  OTOH, we do quietly change symbols to
> strings, so maybe I'm just talking through my hat.

I'd appreciate if you explain in a more detail what happens when and
how.  Is it like in the attached patch, but with logic moved from the
setf'er to the accessor?

> I wasn't sure I understood the following paragraph, either

If one goes beyond ASCII, saves not in UTF-8 (as expected on MS Windows,
but even on Linux LispWorks Personal IDE tried to save a file in
Latin-1), manages local projects with ASDF and upgrades ASDF, he will be
affected.

>From 4724d627e31b929bc58ae8951160fd4c5cfbb997 Mon Sep 17 00:00:00 2001
From: Orivej Desh <[email protected]>
Date: Fri, 23 Mar 2012 06:54:10 +0400
Subject: [PATCH] Move external-format from a property into a slot.

---
 asdf.lisp |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/asdf.lisp b/asdf.lisp
index 6202a7e..fc2c456 100644
--- a/asdf.lisp
+++ b/asdf.lisp
@@ -1178,6 +1178,7 @@ (defclass component ()
    (operation-times :initform (make-hash-table)
                     :accessor component-operation-times)
    (around-compile :initarg :around-compile)
+   (%external-format :accessor %component-external-format :initform nil)
    ;; XXX we should provide some atomic interface for updating the
    ;; component properties
    (properties :accessor component-properties :initarg :properties
@@ -1297,13 +1298,13 @@ (defparameter *utf-8-external-format*
 source code.")
 
 (defmethod component-external-format ((c component))
-  (or (component-property c :external-format)
+  (or (%component-external-format c)
       (aif (component-parent c)
            (component-external-format it)
            *utf-8-external-format*)))
 
 (defmethod (setf component-external-format) (new-value (c component))
-  (setf (component-property c :external-format)
+  (setf (%component-external-format c)
         (or
          #+clisp (and (keywordp new-value)
                       (find-symbol* new-value :charset))
-- 
1.7.9.4

_______________________________________________
asdf-devel mailing list
[email protected]
http://lists.common-lisp.net/cgi-bin/mailman/listinfo/asdf-devel

Reply via email to