Re: Typed Clojure 0.1-alpha2

2012-04-22 Thread Softaddicts
Oups :) Should have read twice :) > He did say, compile-time error. These errors are at run-time - that > is, the following is just as obviously bad, but generates no warning > until bar is called: > > (defn foo [x] 1) > > (defn bar [y] (foo y 1)) ;; compiles fine > > (bar 5) ;; throws runtime

Re: Typed Clojure 0.1-alpha2

2012-04-21 Thread Alan Malloy
He did say, compile-time error. These errors are at run-time - that is, the following is just as obviously bad, but generates no warning until bar is called: (defn foo [x] 1) (defn bar [y] (foo y 1)) ;; compiles fine (bar 5) ;; throws runtime exception On Apr 21, 5:14 pm, Softaddicts wrote: >

Re: Typed Clojure 0.1-alpha2

2012-04-21 Thread Softaddicts
I assumed he was talking about Clojure on the JVM... We came to a point where specifying the implementation is a requirement when posting on this list to prevent confusion :))) Luc > The ClojureScript compiler doesn't seem to do those kinds of checks, but > the Clojure compiler does. > > On 21

Re: Typed Clojure 0.1-alpha2

2012-04-21 Thread Stuart Campbell
The ClojureScript compiler doesn't seem to do those kinds of checks, but the Clojure compiler does. On 21 April 2012 09:18, Casper Clausen wrote: > Looks interesting. > > Personally I always thought clojure's handling of function arity is a > bit strange. I don't understand why calling a functio

Re: Typed Clojure 0.1-alpha2

2012-04-21 Thread Softaddicts
user=> (defn a [x y] x) #'user/a user=> (a 1) java.lang.IllegalArgumentException: Wrong number of args passed to: user$a (NO_SOURCE_FILE:0) user=> (a 1 2) 1 user=> (a 1 2 3) java.lang.IllegalArgumentException: Wrong number of args passed to: user$a (NO_SOURCE_FILE:0) user=> user=> (defn b

Re: Typed Clojure 0.1-alpha2

2012-04-21 Thread Casper Clausen
Looks interesting. Personally I always thought clojure's handling of function arity is a bit strange. I don't understand why calling a function like this (defn testfn [one two] ...) (test-fn 1) is not at least a compiler warning, possibly with a switch for the compiler for strict checking. I un