-
Notifications
You must be signed in to change notification settings - Fork 22
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
Base string patterns don't match general strings #136
Comments
This is in SBCL, where base-char and character are different types and where (upgraded-array-element-type 'base-char) is base-char. |
Also, I note that these matches all work in Optima. |
Hmmmm |
There would be a mention in CLHS about the default type for literal strings which I don't remember. |
The standard macro for " (see http://www.lispworks.com/documentation/lw50/CLHS/Body/02_de.htm ) is described as returning a simple-string. A simple-string can have any element-type that is either character or a subtype of character. In SBCL, there's a readtable flag that causes SBCL to read strings as simple-base-strings when all the characters are base-chars. This is normally disabled, and turning it on breaks some quicklisp packages (because they assume a string constant can be copied and then updated with an arbitrary non-base-char, which is not standard compliant code.) The particular problem I had with this was worked around by explicitly converting the strings to (array character (*)) when the match form was constructed (inside a macro). The underlying problem is still there, though, I'm just not hitting it. |
CL-USER> (trivia:match "x" (#.(coerce "x" 'base-string) t))
NIL
CL-USER> (trivia:match (coerce "x" 'base-string) (#.(coerce "x" 'base-string) t))
T
CL-USER> (trivia:match (coerce "x" 'base-string) ("x" t))
T
The text was updated successfully, but these errors were encountered: