Opened 14 years ago
Closed 14 years ago
#322 closed task (fixed)
SRFI 88 violation of keyword v symbol
Reported by: | Kon Lovett | Owned by: | felix winkelmann |
---|---|---|---|
Priority: | minor | Milestone: | |
Component: | core libraries | Version: | 4.6.x |
Keywords: | read-syntax keyword | Cc: | Kon Lovett |
Estimated difficulty: |
Description
'|foo|: should be a keyword but is read as two items
'{foo:| should be a symbol but is a keyword
Change History (8)
comment:1 Changed 14 years ago by
Type: | defect → task |
---|
comment:2 follow-up: 3 Changed 14 years ago by
Cc: | Kon Lovett added |
---|
Ok, but it seems a bit "lawyerly", given that the essence - quoted symbol - is implemented.
I don't remember what I was doing but I think I was bothered that there didn't seem a clear read syntax for a "quoted keyword". So, yes, desirable.
(I still think it a "defect", given my weaker logic, but low-priority in any case.)
comment:3 Changed 14 years ago by
Keywords: | read-syntax keyword added |
---|---|
Milestone: | 4.6.0 |
Replying to kon:
Ok, but it seems a bit "lawyerly", given that the essence - quoted symbol - is implemented.
It certainly was a "lawyerly" reply.
I don't remember what I was doing but I think I was bothered that there didn't seem a clear read syntax for a "quoted keyword". So, yes, desirable.
(I still think it a "defect", given my weaker logic, but low-priority in any case.)
I don't think your logic is in any way weaker - I just have to ask how much of an annoyance this is. I check out the code and see if there can be a more consistent syntax be found.
comment:4 Changed 14 years ago by
Owner: | set to felix winkelmann |
---|---|
Status: | new → assigned |
comment:5 Changed 14 years ago by
I have changed the symbol reader [experimental 55ad083] to allow the following:
(symbol->string '|abc def|) => "abc def" (symbol->string '|abc||def|) => "abcdef" (symbol->string '|abc|xyz|def|) => "abcxyzdef" (symbol->string '|abc\|def|) => "abc|def" (symbol->string 'abc\ def) => "abc def"
|abc:|
and |abc|:
both will return a keyword. Is this acceptable?
comment:6 Changed 14 years ago by
I really expected this to be "back burner". Wow, fun with quoted symbols.
SRFI-88 says |abc:| is a symbol & |abc|: is a keyword. This makes some sense. The "keyword quote" (':') is much like the quote - '|'foo| has printname "'foo" & '|abc:| has "foo:".
So, given the examples above, I think:
'|abc|:xyz|def|: is a keyword but '|abc|:xyz|def| is a symbol.
'abc\ def: is a keyword, since only the space is escaped .
bar|) be '('foo bar), as it is in Chicken 4.5.7 or '('foobar), as I guess it would be in [experimental 55ad083]? |
Seems the idea is if a "keyword quote" is directly outside of the symbol quote then a keyword. For Chicken, assuming keyword-style is #:prefix, ':|abc|xyz|def| is a keyword & '|abc|xyz|def|: is two tokens? When keyword-style is #:suffix, ':|abc|xyz|def| is two tokens?
What about '|abc|:|def| & prefix keywords? A quoted symbol & a keyword? Just a quoted symbol?
(Still kinda think this is a lower priority.)
comment:7 Changed 14 years ago by
Priority: | major → minor |
---|---|
Version: | 4.5.x → 4.6.x |
comment:8 Changed 14 years ago by
Resolution: | → fixed |
---|---|
Status: | assigned → closed |
See experimental for an attempt to fix this.
Replying to kon:
(The latter is intended to be {{|foo:|}}, I assume?)
The SRFI-88 document requires this only for implementations that support SRFI-75, which chicken does not, so this is not a violation of the spec.
Now, would it be desirable adding support for the given examples?