Unexpected error when implementing methods on Object

Open
#825 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
clojure
Domain
compilers

Research direction

Reproduce the issue with the bb and nbb commands shown, then compare their behavior with the working plk example and the Clojure JVM error. Done means implementing pop on Object no longer produces the unresolved-symbol error and the RingBuffer example behaves consistently with the stated ClojureScript behavior.

Written by the indexing model from the issue text.

Description

bb -e "(deftype RingBuffer [head tail] Object (pop [_]))"
----- Error --------------------------------------------------------------------
Type:     clojure.lang.ExceptionInfo
Message:  Could not resolve symbol: sci.impl.records/pop
Phase:    analysis

Same with nbb.

Error in Clojure JVM:

Can't define method not in interfaces: pop

Apparently in CLJS it's valid to implement any method on Object:

plk -e "(deftype RingBuffer [head tail] Object (pop [_])) (.pop (->RingBuffer 1 []))"
Dominant language
Clojure
Stars
1.4k
Forks
109
Avg merge
1m
Merged PRs (30d)
26

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from babashka/sci

All issues in babashka/sci

Similar issues

More Clojure issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.