I welcome the strict checking over backwards compatibility for broken 
syntax. E. g. allowing things like symbols in the ns decl would require 
supporting that as a feature in future updates, analyzer code, other hosts 
etc. The Clojure devs should not have to worry things with so little use.

Still the error messages are simply far from good enough and that is what 
appears to me as the main problem OP has. If the compiler had pointed him 
to two fixes he could have done in a minute then he had not complained and 
instead felt more happy with his new compiler. 

Here is my story when I loaded a large codebase today with 1.9-alpha11:

Call to clojure.core/defn did not conform to spec: In: [1 0] val:
   ({:keys [money/major money/minor money/currency], :or #:money{major
   0, minor 0, currency :EUR}}) fails spec:
   :clojure.core.specs/arg-list at: [:args :bs :arity-1 :args]
   predicate: (cat :args (* :clojure.core.specs/binding-form) :varargs
   (? (cat :amp #{(quote &)} :form
   :clojure.core.specs/binding-form))), Extra input In: [1 0] val:
   {:keys [money/major money/minor money/currency], :or #:money{major
   0, minor 0, currency :EUR}} fails spec:
   :clojure.core.specs/arg-list at: [:args :bs :arity-n :bodies :args]
   predicate: vector?  :clojure.spec/args (format-money [{:keys
   [money/major money/minor money/currency], :or #:money{major 0,
   minor 0, currency :EUR}}] (str major "," (if (zero? minor) "-"
   minor) " €"))


I know where the problem is immediately  because I looked at above error 
and quickly jumped to the code that didn't work. Then I guessed it right 
because I know what has been changed from Alex Release notes and because I 
had recently inquired on this board about :or destructoring and probably 
because I am a long time Clojure user. The problem is that :or in map 
destructuring with namespaced keywords was not officially supported before 
1.9 (but sadly worked exactly opposite to how it is supported now)

Compare that the more common story of someone who has not followed every 
newspiece lately and just wants to upgrade from 1.8 to 1.9 - How could he 
tell whats wrong from above error message? Following above error message by 
looking up specs and following index paths like [1 0] is a manual process 
that costs and feels like debugging a difficultly hidden bug. The 
time/utility distance to a hand written macro assert like "Keys in :or 
destructoring must be unqualified symbols" currently does not justify the 
use of specs for such things. It's by far worse than the NPE Stacktraces 
popping up from nowhere that one learns to value and utilize after a month 
or so in Clojure. 

It seems that improving the error messages we can calculate from specs data 
is something that more people should think about and improve for 1.9. I'd 
be willing to invest time if needed / input is welcome. Alternatively a way 
to integrate custom error messages into specs directly could also be 
helpful.
 
(But I still don't really see how above spec tells me that I shouldn't use 
qualified symbols in :or destructoring - do you?)

On Monday, August 22, 2016 at 5:08:57 PM UTC+2, Alex Miller wrote:
>
> I've added library related fixes related to core specs to an info page at:
>
> http://dev.clojure.org/display/design/Errors+found+with+core+specs
>
>
> On Sunday, August 21, 2016 at 8:24:20 PM UTC-5, Alex Miller wrote:
>>
>> On Sunday, August 21, 2016 at 5:28:57 PM UTC-5, lvh ‌ wrote:
>>>
>>> FYI, while I disagree with your conclusion (I think we should go fix 
>>> libraries instead), I ran into the same issue just now for roughly the same 
>>> reason, except the thing that pulled in an old version of core.unify was 
>>> core.typed, which pulls in 0.5.3 through core.contracts. 
>>>
>>
>> BTW, core.contracts was also updated to 0.0.6 last week to use the latest 
>> core.unify.
>>
>>

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to clojure+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to