portkey-cloud / portkey

Live-coding the Cloud
144 stars 7 forks source link

genclass vs tree-shaking #8

Closed cgrand closed 6 years ago

cgrand commented 6 years ago

resolve the genclass init issue

cgrand commented 6 years ago

In static init a genclassed class invokes clojure.lang.Util/loadWithClass to initialise its implementation namespace. Adding this namespace (or its compiled class) is not a good fit for the snapshotting approach (used vars are going to be traced anyway so there's no use in initialising them and it may even create ordering issues if init occurs after restoring snapshot). So init must be disabled. Either through byte code rewriting or by adding a fake init resource.