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

CLJS 1.12 Notes #235

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions devnotes/cljs-1.12.org
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
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
** 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
***** 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`
*** Not supported
Loading