Opened 14 years ago

Closed 14 years ago

Last modified 12 years ago

#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 Jim Ursetto)

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 Jim Ursetto

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).

comment:2 Changed 14 years ago by Jim Ursetto

Component: extensionscore libraries
Description: modified (diff)
Owner: changed from Jim Ursetto to felix winkelmann
Status: newassigned
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:3 Changed 14 years ago by felix winkelmann

This is invalid syntax. I don't see the bug.

comment:4 Changed 14 years ago by felix winkelmann

In fact, the reader should report an error in this case.

comment:5 Changed 14 years ago by felix winkelmann

Ok, I got it now, I think. "#:" will trigger a read-error, |#:| will be printed escaped.

comment:6 Changed 14 years ago by felix winkelmann

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 felix winkelmann

Resolution: fixed
Status: assignedclosed

I have applied the changes to "experimental". #322 is not fixed, yet.

comment:8 Changed 14 years ago by Jim Ursetto

Resolution: fixed
Status: closedreopened

I just tried experimental and I see no difference in any of the erroneous test cases above. What am I doing wrong?

comment:9 Changed 14 years ago by Jim Ursetto

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 in reply to:  9 ; Changed 14 years ago by felix winkelmann

Resolution: duplicate
Status: reopenedclosed

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 in reply to:  10 Changed 14 years ago by felix winkelmann

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.

#322, not #332

comment:12 Changed 14 years ago by felix winkelmann

Milestone: 4.7.04.8.0

Milestone 4.7.0 deleted

comment:13 Changed 12 years ago by felix winkelmann

Milestone: 4.8.04.9.0

Milestone 4.8.0 deleted

Note: See TracTickets for help on using tickets.