#562 closed defect (duplicate)
Chicken reader does not maintain quotes on |#:|
Reported by: | Jim Ursetto | Owned by: | felix winkelmann |
---|---|---|---|
Priority: | major | Milestone: | 4.9.0 |
Component: | core libraries | Version: | 4.6.x |
Keywords: | the colossal colon caper | Cc: | |
Estimated difficulty: |
Description (last modified by )
string->symbol on |#:| works, but reading it does not. See comment below.
This causes node (chicken read-syntax #:) to be not properly indexed. It can be accessed directly but not via the index, because the index entry looks like (: (chicken read-syntax)) instead of (|#:| (chicken read-syntax)). Although it is written out correctly initially, once the index goes through a read/modify/write cycle (on a different symbol) the |#:| becomes #: and then eventually :.
Indirectly noticed by mario.
Change History (13)
comment:1 Changed 14 years ago by
comment:2 Changed 14 years ago by
Component: | extensions → core libraries |
---|---|
Description: | modified (diff) |
Owner: | changed from Jim Ursetto to felix winkelmann |
Status: | new → assigned |
Summary: | chicken-doc does not properly index #: → Chicken reader does not maintain quotes on |#:| |
This is a bug in core. string->symbol on |#:| works, but reading it does not. It works fine for other symbols, such as |#?|. This appears to be a bug in the reader not the writer.
#;7> (string->symbol "#:") ; => |#:| (with-input-from-string "((|#:|))" read) ; => ((#:)) #;4> '((|#:|)) ; => ((#:)) #;5> '|#:| ; => #: #;12> (write '|#:|) ; => #: #;13> (write (string->symbol "#:")) ; => |#:| (with-input-from-string "((|#?|))" read) ; => ((|#?|)) #;6> '|#?| ; => |#?|
comment:5 Changed 14 years ago by
Ok, I got it now, I think. "#:" will trigger a read-error, |#:| will be printed escaped.
comment:6 Changed 14 years ago by
BTW, there is a general problem with escaped colons and read/write invariance (see #322). This has to be solved for a correct handling of this problem.
comment:7 Changed 14 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
I have applied the changes to "experimental". #322 is not fixed, yet.
comment:8 Changed 14 years ago by
Resolution: | fixed |
---|---|
Status: | closed → reopened |
I just tried experimental and I see no difference in any of the erroneous test cases above. What am I doing wrong?
comment:9 follow-up: 10 Changed 14 years ago by
If I understand you correctly, the primary problem cannot be fixed without fixing #322, that is:
(with-input-from-string (with-output-to-string (lambda () (write (string->symbol "#:")))) read)
currently results in #:
but should result in |#:|
.
If so, what change did you make other than having #: result in a reader error? Your reply indicates an escaping change was made, but I don't see any difference there.
comment:10 follow-up: 11 Changed 14 years ago by
Resolution: | → duplicate |
---|---|
Status: | reopened → closed |
Replying to zbigniew:
If so, what change did you make other than having #: result in a reader error? Your reply indicates an escaping change was made, but I don't see any difference there.
Right, that second change was pointless as (string->symbol "#:")
is already handled. Now #332 needs to be fixed.
comment:11 Changed 14 years ago by
Replying to felix:
Replying to zbigniew:
If so, what change did you make other than having #: result in a reader error? Your reply indicates an escaping change was made, but I don't see any difference there.
Right, that second change was pointless as
(string->symbol "#:")
is already handled. Now #332 needs to be fixed.
Specifically this apparently leads to a 500 internal error when doing an empty regex search on chickadee. However searching for # does not error (but does not show #:, as expected).