Skip to content

access key and function name collision #22

@Junker

Description

@Junker

In some situations, when an access key has the same name as a function, unexpected behaviour occurs.

Example.

CL-USER> (DEFVAR V1 '(:A 1 :B 2 :SORT "desc"))
V1
CL-USER> (ACCESS:WITH-DOT () 'V1.A)
(ACCESS:ACCESSES V1 'A)
CL-USER> (ACCESS:ACCESSES V1 'A)
1
CL-USER> (ACCESS:ACCESSES V1 'SORT)

invalid number of arguments: 1
   [Condition of type SB-INT:SIMPLE-PROGRAM-ERROR]

Restarts:
 0: [REPLACE-FUNCTION] Call a different function with the same arguments
 1: [CALL-FORM] Call a different form
 2: [RETRY] Retry SLIME REPL evaluation request.
 3: [*ABORT] Return to SLIME's top level.
 4: [ABORT] abort thread (#<THREAD tid=1620761 "repl-thread" RUNNING {1002000003}>)

Backtrace:
  0: (SORT (:A 1 :B 2 :SORT "desc")) [external]
  1: (ACCESS:CALL-IF-APPLICABLE (:A 1 :B 2 :SORT "desc") #<FUNCTION SORT> :WARN-IF-NOT-A-FN? NIL)
  2: (ACCESS:ACCESS (:A 1 :B 2 :SORT "desc") SORT :TYPE NIL :TEST NIL :KEY NIL :SKIP-CALL? NIL)
  3: (ACCESS:ACCESSES #<unavailable argument> SORT)
  4: (SB-INT:SIMPLE-EVAL-IN-LEXENV (ACCESS:ACCESSES V1 (QUOTE SORT)) #<NULL-LEXENV>)
  5: (EVAL (ACCESS:ACCESSES V1 (QUOTE SORT)))
 --more--

This happens because the SORT function exists and is being called.
I noticed that the ACCESS function has a SKIP-CALL? key, but it is not accessible from the ACCESSES function or with dot-syntax.
Maybe should add SKIP-CALL? key in the ACCESSES and WITH-DOT functions etc.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions