Open issues

Manual type hint in multiarity fns is ignored
CLJS-3188
re-seq creates too many matches
CLJS-3187
Propagate type information through `apply`
CLJS-3186
Facilitate protocol static dispatch inlining
CLJS-3185
Externs inference fails, even when manual type hint is provided
CLJS-3181
Propagate type information through `identity`
CLJS-3180
Faster integer division in TransientArrayMap for entry count
CLJS-3179
Advanced unit test failure on Windows
CLJS-3178
support calling static function from import with slash notation
CLJS-3177
Emit a warning if you try to dynamically set a goog-define var
CLJS-3175
Optimize dissoc on IMap values
CLJS-3174
case statement with embedded list test constant
CLJS-3173
def in a letfn function emits unwanted warning
CLJS-3166
Improve perf of cljs.compiler/distinct-keys?
CLJS-3142
Invalid asset-path on Windows
CLJS-3139
global-exports do not work with 'scoped' ns names
CLJS-3138
Cannot defmulti /
CLJS-3135
ident namespace and name intrinsics
CLJS-3132
UUID compares equal to other values
CLJS-3130
Resurrect -with-meta optimizations
CLJS-3118
Support transitive Node dependencies with foreign libraries
CLJS-3117
Invoke elements in PAM -conj
CLJS-3116
Restrict -conj on maps via seqs to map entries
CLJS-3115
Check for pair when conj vector on map
CLJS-3111
ex-triage provides full path in :clojure.error/source
CLJS-3110
Add :clojure.error/path to ex-triage output
CLJS-3109
Remove return type hint from distinct?
CLJS-3106
Remove return type hint from undefined?
CLJS-3105
Remove return type hints from true? and false?
CLJS-3104
Hint js-keys returns array
CLJS-3103
Hint js-delete returns Boolean
CLJS-3102
Eliminate all string coercions in str macro
CLJS-3094
Support generation of ES6 classes
CLJS-3084
Show visible error when Node.js require fails
CLJS-3083
Missing warning when npm-deps shadows global-exports or vice versa
CLJS-3082
Bad error message for deftype with method with no parameters
CLJS-3070
No warning about unqualified calls to private function in cljs.core
CLJS-3069
Closure Compiler snapshot failing with Unexpected module type: SCRIPT
CLJS-3064
Generative test involving persistent queue reversed order
CLJS-3060
[core.specs] Destructuring spec is overly restrictive in namespaced :keys
CLJS-3046
cljs.main: Stackoverflow rhino evaluating undefined JavaScript form
CLJS-3045
Improve error printing in clojure.main with -m, -e, etc
CLJS-3044
:foreign-libs generates files with empty exports due to namespace var shadowing
CLJS-3040
Fail fast for s/with-gen on undefined spec
CLJS-3029
mulitmethod apply with >20 args fails
CLJS-3024
cljs.repl is not loaded in node socket io-prepl, which is required for formatting errors (err->str)
CLJS-3022
Error->map should produce qualified symbols for :type
CLJS-3019
Enable cljs.core.specs.alpha
CLJS-3016
Promote Error->map to be a core fn
CLJS-3014
clojure.string/split on empty regex includes empty string in results
CLJS-3007
476 issues

Simplify macro usage

Description

The usage of macros from CLJS is very explicit and users of any given namespace must remember whether it comes with macros and which vars are macros. This leads to rather verbose :require statements which are confusing and lead to unexpected results if incomplete (eg. missing :refer-macros).

I think the user should not need to know whether something is a macro or not, they should just be able to use it.

I implemented a proof-of-concept that

will work just find and do the correct thing with regards to macros (assuming the namespace has a corresponding clj namespace, :require-macros is unaffected). No changes to any code are necessary as the implementation uses ana/passes, it is also fully backwards compatible.

Implementation points which should be discussed

  • The CLJS namespace with macros currently has to opt-in through a bit of metadata (eg. (ns my-ns-with-macros {:load-macros true})), that might not be necessary and maybe should default to true.

  • The implementation assumes compilation happens in dependency order. shadow-build always does this, I'm not too sure about CLJS though. Given ana/analyze-deps equals true that is guaranteed but I'm not sure that is always the case.

If there is any interest I can provide a patch, until then refer to the proof-of-concept [1].

[1] https://github.com/thheller/shadow-build/blob/f37cfa598f1e90dd66e333d1e45580ea25650025/src/clj/shadow/cljs/passes.clj#L30-L82

Environment

None

Status

Assignee

Unassigned

Reporter

Thomas Heller

Labels

None

Approval

None

Patch

None

Priority

Major
Configure