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
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:
>
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
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
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
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