4 ms·
> While statically typed, Clojure is an aggressively dynamically checked language. Not sure what that means, thought Clojure was a dynamically typed language w
by virtualwhys 11y ago
> While statically typed, Clojure is an aggressively dynamically checked language.
Not sure what that means, thought Clojure was a dynamically typed language with optional static types (via Clojure.Typed). If it were statically typed then it would not blow up at run time when you, for example, mke a typo.
Personally I find Clojure.Typed code far more readable, not to mention the added safety/performance. Any chance that will become the default? A statically typed Clojure + ClojureScript would be pretty compelling ;-)
- pron 11y ago> not to mention the added safety/performance I believe core.typed has no effect -- neither positive nor negative -- on performance. AFAIK, it doesn't affect code generation in any way.
- lemming 11y agoThis is correct - core.typed can't interact with the compiler, it's purely a correctness checking tool.
- virtualwhys 11y ago> I believe core.typed has no effect -- neither positive nor negative -- on performance Interesting, assumed otherwise. Groovy, another dynamic language with optional static typing, does benefit performance-wise when electing to use the `@CompileStatic` annotation on applicable code blocks. A Clojure.Typed with performance improvements would certainly benefit projects like Storm. Probably a ton of work involved though, otherwise it would have been done already.
- moomin 11y agoThere's two typing systems here: core.typed which is an interesting research project which has its own type system and a focus on program correctness, and Clojure's own type annotations, which use Java's type system and affect performance. The article is about improving the latter. Hope this helps.
- vorg 11y agoGroovy also has two such typing systems. Type tagging, which has been present since Groovy 1.x, causes runtime type checks and actually slows down the code. Developers would use Java if they needed compile-time typing, say, for performance. Since Groovy 2, however, the `@CompileStatic` annotation has been available. It's not being used much, probably because people using Groovy just use it for scripting, e.g. testing Java code or in Gradle build scripts. Because only one programmer built it, many developers are concerned about residual bugs, and just use Java or Scala instead.
- virtualwhys 11y agoThat's crazy if what you say is true in your July 14th post [1]. I left in 2010, what a mess the project has become o_O http://gavingroovygrover.tumblr.com/ http://gavingroovygrover.tumblr.com/
- vorg 11y agoYou can reference that blog entry directly, i.e. http://gavingroovygrover.tumblr.com/post/124058010761/groovys-manifesto-the-struggle-continues http://gavingroovygrover.tumblr.com/post/124058010761/groovy...
- jeletonskelly 11y agoPerhaps you would like Annotate (https://github.com/roomkey/annotate https://github.com/roomkey/annotate). Type annotation checking in development, but no overhead in production.
- sitkack 11y agoDoes it interact with type hinting? Because then it could actually speed up production code.
- weavejester 11y agoMy guess is that's a typo, and the first sentence was meant to be: While not statically typed, Clojure is an aggressively dynamically checked language.
- loevborg 11y agoIt's worth noting that, although Clojure is undoubtedly dynamically typed, it does more extensive compile-time checking than, e.g., Python or PHP. For example ;; clojure (let [colour :red] (f color)) will throw a compile-time error, whereas # python colour = "red" f(color) will only show up at runtime. That makes a big practical difference.
- jballanc 11y agoThis has nothing to do with type discipline and everything to do with early vs late binding.
- deleted 11y ago[deleted]