Opened 12 years ago

Closed 12 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 in reply to:  description Changed 12 years ago by felix winkelmann

Type: defecttask

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?

comment:2 Changed 12 years ago by Kon Lovett

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

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 12 years ago by felix winkelmann

Owner: set to felix winkelmann
Status: newassigned

comment:5 Changed 12 years ago by felix winkelmann

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 12 years ago by Kon Lovett

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 [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 12 years ago by felix winkelmann

Priority: majorminor
Version: 4.5.x4.6.x

comment:8 Changed 12 years ago by felix winkelmann

Resolution: fixed
Status: assignedclosed

See experimental for an attempt to fix this.

Note: See TracTickets for help on using tickets.