Summary
SRFI 88 violation of keyword v symbol
Metadata
- Id: cb320323267f6688b8a05422dc762afa27d5cfd9
- Trac id: 322
- Type: task
- Reporter: kon
- Owner: felix
- Cc: kon
- Status: closed
- Component: core libraries
- Estimated difficulty:
- Resolution: fixed
- Priority: minor
- Milestone:
- Version: 4.6.x
- Changetime: 2011-04-13 09:38:29 UTC
- Created: 2010-08-10 02:45:52 UTC
- Keywords: read-syntax keyword
Description
'|foo|: should be a keyword but is read as two items
'{foo:| should be a symbol but is a keyword
Changes and comments
[2010-08-11 14:30:50 UTC] felix changed type from defect to task
[2010-08-11 14:30:50 UTC] felix wrote:
Replying to kon: > '|foo|: should be a keyword but is read as two items > > '{foo:| should be a symbol but is a keyword >
(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?
[2010-08-15 04:43:00 UTC] kon set cc to kon
[2010-08-15 04:43:00 UTC] kon wrote:
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.)
[2010-08-17 21:56:00 UTC] felix set keywords to read-syntax keyword
[2010-08-17 21:56:00 UTC] felix removed milestone 4.6.0
[2010-08-17 21:56:00 UTC] felix wrote:
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.
[2010-08-17 21:56:05 UTC] felix changed status from new to assigned
[2010-08-17 21:56:05 UTC] felix set owner to felix
[2010-08-18 11:46:27 UTC] felix wrote:
I have changed the symbol reader 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?
[2010-08-20 04:02:22 UTC] kon wrote:
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 .
'|abc|:|def| is a symbol & '|abc|:|def|: a keyword? This one is tricky because quoted symbol concatenation is an issue for people who don't like whitespace. Should '('|foo||bar|) be '('foo bar), as it is in Chicken 4.5.7 or '('foobar), as I guess it would be in 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.)
[2010-09-14 08:53:03 UTC] felix changed priority from major to minor
[2010-09-14 08:53:03 UTC] felix changed version from 4.5.x to 4.6.x
[2011-04-13 09:38:29 UTC] felix changed status from assigned to closed
[2011-04-13 09:38:29 UTC] felix set resolution to fixed
[2011-04-13 09:38:29 UTC] felix wrote:
See experimental for an attempt to fix this.