[Ecls-list] Automatic string conversion - wanted or needed?

Pascal J. Bourguignon pjb at informatimago.com
Sat Apr 26 20:38:55 UTC 2014


"Philipp Marek" <philipp at marek.priv.at> writes:

> Hi everybody,
>
> on my way through the quicklisp systems I encountered a failure in closure-common, which
> is needed by eg. dbus (through cxml).
>
>
> In cxml/xml/xml-parse.lisp there's a definition
>
>   (defstruct (internal-entdef
>     ...
>     (value (error "missing argument") :type rod)
>
> and closure-common/utf8.lisp has
>
>   (deftype rune () 'character)
>   (deftype rod () '(vector rune))
>
>
>
> In ECL the double_quote_reader() in src/c/read.d included a
> conversion, so that
>
>   (TYPE-OF "Σ") has CHARACTERS, but
>   (TYPE-OF "a") "only" BASE-CHARs.
>
> But with that conversion the :TYPE ROD in INTERNAL-ENTDEF
> isn't satiesfied anymore.
>
>
> Now, my question - is it okay to remove the type conversion as
> in the attached patch? Or should it be kept that way, because
> of some CL requirements?
>   (I checked SBCL, ABCL, and CLISP - all of these return
>    CHARACTERS for _both_ of the above TYPE-OF forms.)

CLHS is clear about it, the standard reader macro #\" must read a
SIMPLE-STRING, which is a (simple-array character (*)).

    2.4.5 Double-Quote

    Syntax: "<<text>>"

    The double-quote is used to begin and end a _string_.
    …
    The accumulated characters up to but not including the matching
    double-quote are made into a _simple_string_ and returned. It is
    implementation-dependent which attributes of the accumulated
    _characters_ are removed in this process.


    string n. a specialized vector that is of type string, and whose
    elements are of type character or a subtype of type character. 


   Type SIMPLE-STRING
   
   … When used as a type specifier for object creation, simple-string
   means (simple-array character (size)). 



So (simple-array character (size)) should be the type of the returned
object.



Therefore this is a conformity error, and your patch should be applied.


-- 
__Pascal Bourguignon__
http://www.informatimago.com/
"Le mercure monte ?  C'est le moment d'acheter !"




More information about the ecl-devel mailing list