From 613575076d14b5de5f4f2b665a8bcb33ec83ae9b Mon Sep 17 00:00:00 2001 From: davidnolen Date: Tue, 24 Sep 2024 15:36:13 -0400 Subject: [PATCH 1/3] add some basic notes for 1.12 --- devnotes/cljs-1.12.org | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 devnotes/cljs-1.12.org diff --git a/devnotes/cljs-1.12.org b/devnotes/cljs-1.12.org new file mode 100644 index 000000000..1579ea4f2 --- /dev/null +++ b/devnotes/cljs-1.12.org @@ -0,0 +1,34 @@ +ClojureScript 1.12 Dev Notes + +* Clojure 1.12 introduced method values in the following forms +** `Classname/staticMethod` - existing static method descriptor +** `Classname/.instancedMethod` - describes an instance method +** `Classname/new` - describes a constructor +* `Classname/staticMethod` +** ClojureScript does not use JS class syntax to define anything +** "static fields" are just properties on the ctor fn +** However this could easily be detected by the compiler +*** `(set! (.. Foo -prototype BAR) ...)` +**** where `Foo` is a known deftype +** Clojure can disambiguate between method/properties +*** ClojureScript cannot in the general case +**** foreign JS libraries +*** It can work for Closure Compatible stuff +**** due to externs parsing +** Option: Could assume `Classname/staticMethod` fn +*** CLJS doesn't support anything but namespaces before the `/` +**** So minimal breakage likely +* `Classname/.instanceMethod` no precendent so also easy to handle +* `Classname/new` a special case so easy to handle +** Again `non-namespace/foo` never worked before +* Other considerations +** `^:param-tags` +*** Don't immediately see a use for this +**** We don't have the method selection problem +** `goog.foo.Bar` +*** Users do sometimes depend on global access to Closure libs +*** externs parsing can let us know if `/` should be allowed or not +** if something is `:referred` etc. +*** Can also support `/` +** `js/foo/bar` +*** Not supported From a0506b47c1a031cc3fba20100339d8760d205997 Mon Sep 17 00:00:00 2001 From: David Nolen Date: Wed, 25 Sep 2024 14:33:57 -0400 Subject: [PATCH 2/3] add some bits about global libs --- devnotes/cljs-1.12.org | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/devnotes/cljs-1.12.org b/devnotes/cljs-1.12.org index 1579ea4f2..6277bbf48 100644 --- a/devnotes/cljs-1.12.org +++ b/devnotes/cljs-1.12.org @@ -19,7 +19,7 @@ ClojureScript 1.12 Dev Notes *** CLJS doesn't support anything but namespaces before the `/` **** So minimal breakage likely * `Classname/.instanceMethod` no precendent so also easy to handle -* `Classname/new` a special case so easy to handle +* `Classname/new` a special case so easy to handle ** Again `non-namespace/foo` never worked before * Other considerations ** `^:param-tags` @@ -28,7 +28,14 @@ ClojureScript 1.12 Dev Notes ** `goog.foo.Bar` *** Users do sometimes depend on global access to Closure libs *** externs parsing can let us know if `/` should be allowed or not -** if something is `:referred` etc. -*** Can also support `/` +** js$foo.bar +*** A proposed enhancement to use global libraries as namespaces +*** `js$foo.bar.Baz/staticMethod` when `js$foo.bar` not required +**** it's not a great pattern to encourage +***** macros are a case where it can be useful +****** i.e. macro depends on a require that the user didn't provide +****** combining w/ js$ though seems gratuitous +** if something is `:refer`ed etc. +*** Can easily support `/` ** `js/foo/bar` *** Not supported From 87f5e274521e914c1ae41918d1ebab16c6c73c48 Mon Sep 17 00:00:00 2001 From: davidnolen Date: Wed, 25 Sep 2024 22:24:59 -0400 Subject: [PATCH 3/3] counterpoint --- devnotes/cljs-1.12.org | 3 +++ 1 file changed, 3 insertions(+) diff --git a/devnotes/cljs-1.12.org b/devnotes/cljs-1.12.org index 6277bbf48..fb5e0f958 100644 --- a/devnotes/cljs-1.12.org +++ b/devnotes/cljs-1.12.org @@ -35,6 +35,9 @@ ClojureScript 1.12 Dev Notes ***** macros are a case where it can be useful ****** i.e. macro depends on a require that the user didn't provide ****** combining w/ js$ though seems gratuitous +***** that said, argument for consistency +****** and no need to prioritize library writers +****** convenient for solo developers on their blog etc. ** if something is `:refer`ed etc. *** Can easily support `/` ** `js/foo/bar`