r/Clojure • • Jan 19 '14

Clojure, the bad first impressions

http://kodare.net/blog/clojure-bad-first-impressions/
70 Upvotes

81 comments sorted by

View all comments

Show parent comments

-10

u/[deleted] Jan 20 '14

Who cares what python does or does not do?

11

u/david72486 Jan 20 '14

It's relevant to see how other languages behave under similar conditions, as a point for comparison.

-6

u/[deleted] Jan 20 '14

Why not compare it to a language that wasn't designed by a clueless newbie? Set your sights higher, comparing to python is like saying you're pretty good at basketball by comparing yourself to primary school standards.

2

u/kankyo Jan 20 '14

...like? And please post the corresponding error message from your chosen language.

5

u/minikomi Jan 20 '14 edited Jan 20 '14

Racket's use of contracts ensures that you get good errors for almost all builtins:

> (+ 3 "yeah")
+: contract violation
  expected: number?
  given: "yeah"
  argument position: 2nd
  other arguments...:
   3
  context...:
   /Applications/Racket v6.0.0.1/collects/racket/private/misc.rkt:87:7

Bonus: doing (help number?) will point you at [number?](http://docs.racket-lang.org/reference/number-types.html#(def._((quote._~23~25kernel)._number~3f))) 's definition

2

u/[deleted] Jan 20 '14

I like CL, this is the result using one implementation (clisp):

[1]> (+ 1 "foo")

*** - +: "foo" is not a number
The following restarts are available:
USE-VALUE      :R1      Input a value to be used instead.
ABORT          :R2      Abort main loop

-2

u/[deleted] Jan 20 '14

Yes, the dreaded Common Lisp errors that won't bail out back to the repl!