Skip to content

Should ACCESS *not* search for a method named by our KEY by default. We can't use symbols as keys reliably. #24

@vindarel

Description

@vindarel

The issue is that you can't use symbols as keys and access them reliably, because access will

See if there is a method named fn specialized on o, or a function named fn and call it if so.

We must pass the :skip-call? parameter to t.

Example:

(defvar v1 '(a 1 b 2 sort "desc"))

(access:access v1 'sort)
=>_ERROR

(access:access v1 'sort :skip-call? t)
"desc"
T

It's not only about built-ins like sort. I got trapped because I used symbols as keys and I have a function of the same name lying around.

I don't know when searching for a function is useful, and this feature is seldom documented and explain.

Conclusion: we can't rely on access (nor accesses) when using symbols as keys.


I suggest to disable this feature by default.

I know this library is under-maintained, but anyone please discuss, if there's demand we'll fork.

see also #22 (there's no workaround when using accesses)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions