This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-05-07
Channels
- # admin-announcements (1)
- # arachne (1)
- # beginners (11)
- # boot (72)
- # cider (7)
- # cljs-dev (9)
- # clojure (31)
- # clojure-czech (8)
- # clojure-poland (1)
- # clojure-russia (7)
- # clojure-uk (17)
- # clojurescript (48)
- # community-development (5)
- # cursive (2)
- # data-science (1)
- # datascript (3)
- # datavis (1)
- # datomic (4)
- # devcards (45)
- # docker (3)
- # hoplon (5)
- # keechma (3)
- # lein-figwheel (1)
- # leiningen (4)
- # luminus (16)
- # off-topic (1)
- # om (2)
- # om-next (1)
- # onyx (4)
- # other-languages (104)
- # overtone (1)
- # re-frame (2)
- # reagent (37)
- # rum (35)
- # untangled (4)
- # yada (4)
@parrellav: sure
say I have a function (defn foo [] (into-array [""]))
, that is, a simple function which returns a java.lang.String array, how do I correctly type-annotate it?
the compiler doesn’t complain, neither does it for (defn ^"[Ljava.lang.String" foo [] (into-array [""]))
bronsa harps on this every chance he gets, but I'm not sure why really. It is intentional that types are treated as hints and thus can attribute the incorrect type without an error. However, it seems totally ok to me to error on badly formed or incorrectly placed types. Primitive type hints are a little trickier since they are not just hints but also affect the generated code.
I "harp" on this because I think that having the compiler error on provably wrong programs at compile time can only be beneficial to the programmer, I don't think it's a controversial opinion to hold
and also because the compiler already does "validate" (well, it crashes) type hints in some cases, but not in others and I value consistency
nevermind the fact that bad type hints can cause runtime crashes at callsites that are often hard to understand
Is there some standard for test naming for clojure.test? is it deftest xyzzy-test, test-xyzzy, or xyzzy-tests?
(defmacro def-hm [hm]
`(do
~@(for [[sym val] hm]
`(def (symbol (name sym)) val))))
(macroexpand-1 '(def-hm {:a 1 😛 2}))
(let [hm {:a 1 😛 2}]
(macroexpand-1 '(def-hm hm)))
@wei if you use #cider and clj-refactor, there is M-x cljr-add-project-dependency. Life is so much better...