What is the advantage of using Spec over simply having the first few lines of the function declare the types of its arguments and assert some things about parameters?
Also, are these checks integrated with the compiler at all? If I specify an integer between -100 and 100 in Spec, can the compiler use the info to create an unboxed type or anything like that?
Rich Hickey explains it much better than me in the Rationale of clojure.spec http://clojure.org/about/rationale , but in short writing specs gives you: validation, error reporting, destructuring, instrumentation, test-data generation, generative test generation
As far as I’m aware, the checks are not integrated with the compiler. They are focused to aid development and run-time validation.