Skip to content

inconsistent keywordization of strings containing slashes #1131

@ikappaki

Description

@ikappaki

Hi,

there appears to be an issue when trying to keywordizing strings containing slashes, such as "abc/xyz". These string don't compare equal to their corresponding namespaced keywords, even though their string representation match.

To reproduce

  • Open up the REPL, create a keywordize slashed string, compare it with its counterpart and inspect it, it fails the check
basilisp.user=> (def issuekw (keyword "abc/xyz"))
#'basilisp.user/issuekw

basilisp.user=> issuekw
:abc/xyz

basilisp.user=> (= issuekw :abc/xyz)
false

basilisp.user=> (namespace issuekw)
nil

basilisp.user=> (name issuekw)
"abc/xyz"

In clojure comparison works as expected, comparing equal with their counterparts, internally the string to a namespace and name components

user=> (def issuekw (keyword "abc/xyz"))
#'user/issuekw
user=>  issuekw
:abc/xyz
user=> (= issuekw :abc/xyz)
true
user=> (namespace issuekw)
"abc"
user=> (name issuekw)
"xyz"

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions