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

Support setting public static fields in classes #804

Open
lispyclouds opened this issue Sep 22, 2022 · 0 comments
Open

Support setting public static fields in classes #804

lispyclouds opened this issue Sep 22, 2022 · 0 comments

Comments

@lispyclouds
Copy link
Member

lispyclouds commented Sep 22, 2022

Is your feature request related to a problem? Please describe.
I stumbled onto this when trying to override the Executor for clojure.lang.Agent. The minimum code that needs to run:

(import '[clojure.lang Agent]
        '[java.util.concurrent Executors])

(set! (.-soloExecutor Agent) (Executors/newFixedThreadPool 10))

Currently, as setting of the public static fields in a class isn't supported, this results in the following error:

----- Error --------------------------------------------------------------------
Type:     clojure.lang.ExceptionInfo
Message:  Invalid assignment target
Data:     {:type :sci/error, :line 4, :column 1, :file "foo.clj", :phase "analysis"}
Location: foo.clj:4:1
Phase:    analysis

----- Context ------------------------------------------------------------------
1: (import '[clojure.lang Agent]
2:         '[java.util.concurrent Executors])
3:
4: (set! (.-soloExecutor Agent) (Executors/newFixedThreadPool 10))
   ^--- Invalid assignment target

----- Stack trace --------------------------------------------------------------
user - foo.clj:4:1

Describe the solution you'd like
I should be able to set that field and other public static fields in a class.

Describe alternatives you've considered
None

Additional context
This is mainly for the ability to be able to override the Executors to support virtual threads in core constructs like (future ...)

@lispyclouds lispyclouds changed the title Support setting public fields in classes Support setting public static fields in classes Sep 22, 2022
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

1 participant