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

Cannot override var in context's namespaces via merge-opts #655

Closed
zampino opened this issue Dec 13, 2021 · 0 comments
Closed

Cannot override var in context's namespaces via merge-opts #655

zampino opened this issue Dec 13, 2021 · 0 comments
Assignees

Comments

@zampino
Copy link

zampino commented Dec 13, 2021

version

 borkdude/sci {:mvn/version "0.2.6"}

platform

Mac

java 16.0.2 2021-07-20
Java(TM) SE Runtime Environment (build 16.0.2+7-67)
Java HotSpot(TM) 64-Bit Server VM (build 16.0.2+7-67, mixed mode, sharing)

problem

sci.core/merge-opts doesn't seem to merge (values referenced by) vars correctly for namespace mappings defined in sci.core/init when trying to override an existing var. The order of the params passed to merge-with here below might be wrong:

https://github.com/babashka/sci/blob/master/src/sci/impl/opts.cljc#L17-L22

repro

(ns repro
  (:require [sci.core :as sci])

(def C (atom (sci/init {:namespaces {'n {'foo 1}}})))
(swap! C sci/merge-opts {:namespaces {'n {'foo 2}}})
(sci/eval-form @C 'n/foo)

expected behavior

The new var should be picked up.

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