More notes on class initialization
See original GitHub issuehttps://github.com/lread/clj-graal-docs#class-initialization
See https://github.com/oracle/graal/discussions/3476
From Graal 22 on, the global --initialize-at-build-time
option will be deprecated.
It is possible to get a list of Clojure-produced packages with something like:
(require 'babashka.main)
(->> (map ns-name (all-ns)) (remove #(str/starts-with? % "clojure")) (map #(str/split (str %) #"\.")) (keep butlast) (map #(str/join "." %)) distinct (map munge) (cons "clojure"))
and then make a comma separated list out of that:
"--initialize-at-build-time=clojure,sci.impl,selmer,babashka.nrepl,babashka.impl.clojure.java,babashka.impl,rewrite_clj.node,bencode,rewrite_clj.parser,babashka.impl.clojure,org.httpkit,rewrite_clj.custom_zipper,rewrite_clj.zip,borkdude.graal,babashka.nrepl.impl,babashka.pods,cognitect,babashka,edamame.impl,cheshire,rewrite_clj,hiccup,sci,borkdude,flatland.ordered,babashka.pods.impl,clj_yaml,babashka.impl.clojure.core,datascript,hf.depstar,babashka.impl.tools,sci.addons,babashka.impl.clojure.test"
This has an additional benefit that not all Java classes are initialized at build time, reducing the chance on any incorrect behavior.
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (5 by maintainers)
Top Results From Across the Web
Initializing Fields - Learning the Java Language
Instance variables can be initialized in constructors, where error handling or other logic can be used. To provide the same capability for class...
Read more >Study guide: Class and object initialization - InfoWorld
This guide complements " Class and Object Initialization. ... from your fellow students, additional examples, and miscellaneous notes and thoughts.
Read more >Objects and Classes: Constructors and Object Initialization
The next detail to note is how objects are created and initialized (i.e. values assigned to its instance variables and its methods names)...
Read more >Initialization — The Swift Programming Language (Swift 5.7)
Initialization is the process of preparing an instance of a class, structure, or enumeration for use. This process involves setting an initial value...
Read more >Initialization of base classes and members (C++ only) - IBM
Initializer list syntax ... If you do not explicitly initialize a base class or member that has constructors by calling a constructor, the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@ericdallo Made a repo here where we can implement this:
https://github.com/clj-easy/graal-build-time
Relevant APIs: