Skip to content
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

access key and function name collision #22

Open
Junker opened this issue Jun 17, 2024 · 3 comments
Open

access key and function name collision #22

Junker opened this issue Jun 17, 2024 · 3 comments

Comments

@Junker
Copy link

Junker commented Jun 17, 2024

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.

@vindarel
Copy link

Hi, it works if you use a :keyword and not a 'symbol to access the key:

(ACCESS:ACCESSES V1 :SORT)
;; => "desc"

best,

@Junker
Copy link
Author

Junker commented Jun 23, 2024

thanks for the solution for ACCESSES, but it doesn't solve problem with dot-syntax.

@vindarel
Copy link

could you explain or showcase what's the problem with the dot syntax?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants