chicken-janitors
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Chicken-janitors] #1077: Symbols containing newlines don't get quot


From: Chicken Trac
Subject: Re: [Chicken-janitors] #1077: Symbols containing newlines don't get quoted by write
Date: Thu, 28 Nov 2013 08:38:08 -0000

#1077: Symbols containing newlines don't get quoted by write
-----------------------------+----------------------------------------------
  Reporter:  sjamaan         |       Owner:  sjamaan
      Type:  defect          |      Status:  new    
  Priority:  major           |   Milestone:  4.9.0  
 Component:  core libraries  |     Version:  4.8.x  
Resolution:                  |    Keywords:         
-----------------------------+----------------------------------------------

Comment(by evhan):

 I think this is a consequence of the way qualified symbols are encoded,
 and affects all symbols whose first byte is less than 32 (please someone
 correct me if any of the following is wrong).

 Any symbol whose name has a leading byte under 32 is considered
 qualified, with that byte specifying the length of the namespace part of
 the ensuing string. Obviously, this is invalid for {{{'|\n|}}}, so when
 it's handled as a qualified symbol in {{{##sys#print}}} after satisfying
 {{{##sys#qualified-symbol?}}} (library.scm:3357),
 {{{##sys#symbol->qualified-string}}} detects this invalid length, falls
 back to simply returning the symbol's string value without any
 qualification, and we get a lone newline printed out as the result.

 You can see what would happen were 10 a valid length by extending the
 symbol, e.g. {{{'|\naaaaaaaaaaa| => ##aaaaaaaaaa#a}}}.

 All that said, I'm not really sure what to do about this. We could make
 {{{##sys#qualified-symbol?}}} check whether its argument has a valid
 namespace length so its behavior at least matches that of {{{split}}}
 (library.scm:1184) and the procedures defined over it, but that leaves
 things dependent on the length of the symbol (e.g. the difference
 between {{{'|\n|}}} and {{{'|\naaaaaaaaaaa|}}} above) so it isn't a
 great option. We could drop {{{namespace-max-id-len}}} so that symbols
 can begin with the more commonly-used values under 32 ({{{\n}}},
 {{{\t}}}, etc.), but even if we dropped it to something quite low we'd
 still have problems with e.g. {{{'|\x03|}}}, and longer namespaces like
 {{{##compiler#}}} might have to change, so that's also not really an
 option either. We could... I don't know. Hopefully I'm missing a really
 obvious fix.

 Thoughts?

-- 
Ticket URL: <http://bugs.call-cc.org/ticket/1077#comment:1>
Chicken Scheme <http://www.call-with-current-continuation.org/>
Chicken Scheme is a compiler for the Scheme programming language.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]