Created
November 22, 2013 13:23
-
-
Save swannodette/7599766 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(let [x (cons 1 nil)] | |
(+ x 1)) | |
;; WARNING: cljs.core/+, all arguments must be numbers, got [cljs.core/Cons number] instead. | |
(let [x (interleave (repeat "foo") (repeat "bar"))] | |
(+ x 1)) | |
;; WARNING: cljs.core/+, all arguments must be numbers, got [cljs.core/LazySeq number] instead. |
Note none of this is a replacement for what core.typed does, it's really only designed to handle the common non-higher order cases. If you need something more powerful than that, you know where to look :)
Getting the primitive arithmetic check in was just a fun way to kick off having more type information in the AST, the real benefit will be around eliminating protocol overheads where we can.
(take 10 (interleave (repeat "foo") (repeat "bar"))) => ("foo" "bar" "foo" "bar" "foo" "bar" "foo" "bar" "foo" "bar")
It's definitely useful! Just wondering if it's a bug.
@ericnormand, sorry I understand the source of your confusion now, that vector is just the types of the argument list - the inference doesn't consider contents of collections - that's definitely outside the realm of what we want to handle in the ClojureScript compiler.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@ericnormand
interleave
returns a lazy sequence, of characters in this case.