|
| 1 | +ClojureScript 1.12 Dev Notes |
| 2 | + |
| 3 | +* Clojure 1.12 introduced method values in the following forms |
| 4 | +** `Classname/staticMethod` - existing static method descriptor |
| 5 | +** `Classname/.instancedMethod` - describes an instance method |
| 6 | +** `Classname/new` - describes a constructor |
| 7 | +* `Classname/staticMethod` |
| 8 | +** ClojureScript does not use JS class syntax to define anything |
| 9 | +** "static fields" are just properties on the ctor fn |
| 10 | +** However this could easily be detected by the compiler |
| 11 | +*** `(set! (.. Foo -prototype BAR) ...)` |
| 12 | +**** where `Foo` is a known deftype |
| 13 | +** Clojure can disambiguate between method/properties |
| 14 | +*** ClojureScript cannot in the general case |
| 15 | +**** foreign JS libraries |
| 16 | +*** It can work for Closure Compatible stuff |
| 17 | +**** due to externs parsing |
| 18 | +** Option: Could assume `Classname/staticMethod` fn |
| 19 | +*** CLJS doesn't support anything but namespaces before the `/` |
| 20 | +**** So minimal breakage likely |
| 21 | +* `Classname/.instanceMethod` no precendent so also easy to handle |
| 22 | +* `Classname/new` a special case so easy to handle |
| 23 | +** Again `non-namespace/foo` never worked before |
| 24 | +* Other considerations |
| 25 | +** `^:param-tags` |
| 26 | +*** Don't immediately see a use for this |
| 27 | +**** We don't have the method selection problem |
| 28 | +** `goog.foo.Bar` |
| 29 | +*** Users do sometimes depend on global access to Closure libs |
| 30 | +*** externs parsing can let us know if `/` should be allowed or not |
| 31 | +** if something is `:referred` etc. |
| 32 | +*** Can also support `/` |
| 33 | +** `js/foo/bar` |
| 34 | +*** Not supported |
0 commit comments