-
Notifications
You must be signed in to change notification settings - Fork 4
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
A package named "", ||:symbol #63
Comments
From a discussion on
|
Also note that not defining such an extension leads to losing print-read consistency, since a symbol in a package named Such a symbol is currently printed either as See this paste for an example: https://plaster.tymoon.eu/view/4480 |
There is a similar problem with potential numbers (see CLHS 2.3.1.1.1). The example of interest here is Also, the following remark:
seems to imply that escape characters are actually part of the token, although it could just be a wording issue. (The token in question is said to be a potential number, which means that a potential number is a token. It is also previously said that "a potential number cannot contain any escape characters", which implies that generally a token can contain escape characters, and thus escape characters are included in the token.) P.S. The same can be said about |
Nope. 5|| is explicitly rejected as syntax for potential numbers by https://www.lispworks.com/documentation/lw61/CLHS/Body/02_caaa.htm This is to stay consistent with things like 5|x| or 5|2| which must both be interpreted as symbols. Having an explicit rule overrides any default interpretation by the algorithm. |
I don't claim that
This is not true for What I do claim, is that it means that the reader algorithm is not correctly defined, and thus needs to be changed. |
A few passages, including the one that I have already cited earlier from CLHS 2.3.1.1.1, suggest that escape characters should be part of the token. Here's another passage that supports that (this time from CLHS 2.3.3):
|
"As IF". But indeed, tokens are not mere strings. A token must remember the character trait of each character. And indeed, to handle the 5|| rule, a token must also remember that it has occurrences of multiple-escapes even if they're empty, so it needs at least one flag in addition to the characters and traits. https://www.lispworks.com/documentation/lw61/CLHS/Body/02_adb.htm Keeping the escapes themselves is not really useful and makes parsing the token more difficult, once the token type is determined from the traits. For example, I rephase 2.3.3 as "if a token consisting only of dots with the character trait of "dot", then ...". ... -> only #. characters with the character trait dot. And yes, the reader algorithm is not formally specified down to these details, because there are various implementation choices possible to implement things like 2.3.3 or 2.3.1.1.1. In the context of wscl, the question is whether there are any ambiguity in the specification, not whether the specification allows various implementations (all behaving the same way). So far I've not seen you demonstrated any ambiguity, ie. strings that could be interpreted in different ways when processed by the lisp reader as specified (applying all the rules). |
And that contradicts the hyperspec, as CLHS 2.2 Reader Algorithm explicitly specifies how tokens are constructed (the phrases used are "y is used to begin a token", "Y is appended to the token being built" e.t.c). The very fact that one part of the spec (namely 2.3.1.1.1) contradicts the other one (2.2) already makes it a WSCL issue; since any "rephrasing" already creates ambiguity. Note that the whole thing with numbers and the consing dot is only "supporting evidence", that is intended to provide context to the main issue -- interpretation of
By the way, the string |
Just in case, by saying that escape characters are part of the token, I don't necessarily mean that they must be put directly into the token being accumulated. It would be enough to, for example, keep track of escaped "intervals" of the form [a, b), with "empty" pairs of multiple escape characters appending an "empty interval" of the form [x, x). [ note: AFAICT this is what Eclector does ]
This rephrasing would mean that |
Well, there are many other examples. Here's what I have found so far (including previous ones for completeness): CLHS 2.1.4 Character Syntax Types:
CLHS 2.3.1.1.1 Escape Characters and Potential Numbers:
Note: potential number is a special kind of token (CLHS 2.3.1.1 Potential Numbers as Tokens):
CLHS 2.4.8.4 Sharpsign Asterisk:
|
The standard doesn't explicitly prohibits a package named
""
, which means that it is allowed.It is not however clear what
||:symbol
means; and if:symbol
is allowed to be interpreted as||:symbol
, defining""
as a global nickname for the"KEYWORD"
package (as AllegroCL does).A simple test (from https://plaster.tymoon.eu/view/4474):
Currently ACL interprets
:symbol
as||:symbol
, defining a global nickname""
for the keyword package to implement the special syntax for keywords.SBCL, CMUCL and CCL interpret
:symbol
and||:symbol
differently, treating the second one as a symbol lookup in the package named""
.ECL, CLASP, CLISP, MKCL, Corman Lisp, LispWorks, JSCL interpret
||:symbol
as:symbol
- as a keyword.It is not clear what ABCL does, since it just crashes trying to read
||:symbol
.The text was updated successfully, but these errors were encountered: