Re: Using :clojure.spec.alpha/invalid inside clojure.core macros throw exception

2019-09-18 Thread Andy Fingerhut
I do not know the specifics of this issue, but just because it was reported
in 2016 does not necessarily imply that the Clojure spec developers believe
it is a bug, rather than something than an unexpected corner case that some
spec users wish would behave differently.

Also, Rich Hickey and Alex Miller (and perhaps others I am unaware of) are
actively working on developing spec version 2.

Andy

On Wed, Sep 18, 2019 at 1:11 PM Peter Hull  wrote:

>
>
> On Wednesday, 18 September 2019 20:48:39 UTC+1, David Bürgin wrote:
>>
>> This is a known issue, see
>> https://clojure.atlassian.net/projects/CLJ/issues/CLJ-1966
>>
> 2016!
>
> --
> 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.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/clojure/6bfbcf08-eaf2-4bd4-ba96-f16f627f4380%40googlegroups.com
> 
> .
>

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/CAKvLtDYcyouJMLH4G289x8dacFuEs65Vpwky3G2iSmrNQNFhfQ%40mail.gmail.com.


Code style: how do you order map keys?

2019-09-18 Thread Yuri Govorushchenko
I usually try to organize related things in different files in the same 
order to ease code reviewing, reading and writing new code. For example: 
order of protocol method declarations, their definitions in records and 
unit tests. And I was wondering what's the best way to order keys in maps 
and specs.

The simple rule could be to always sort keys lexically, so that the order 
stays the same across files and there's no additional thinking needed when 
adding new keys.
But with `s/keys` it's not that simple since `:req`/`:req-un` can break the 
consistency across the files. E.g. during spec definition the correct 
lexical order is `:req-un [:a/x :a/y ::d]`, but during "usage" it will be 
different: `{:d ... :x ... :y ...}`.
The lesser drawback of this approach is that some human-friendliness is 
lost, e.g. keys `host, port, db, user, password` must be ordered as `db, 
host, password, port, user`.

Do you try to maintain the same order of map keys (including keys in specs) 
across the files? If yes, what rules do you follow?

Thank you.

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/d29d4e36-4dee-4bd6-9347-7fa397103f5e%40googlegroups.com.


Re: Using :clojure.spec.alpha/invalid inside clojure.core macros throw exception

2019-09-18 Thread Peter Hull


On Wednesday, 18 September 2019 20:48:39 UTC+1, David Bürgin wrote:
>
> This is a known issue, see 
> https://clojure.atlassian.net/projects/CLJ/issues/CLJ-1966 
>
2016!

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/6bfbcf08-eaf2-4bd4-ba96-f16f627f4380%40googlegroups.com.


Re: Using :clojure.spec.alpha/invalid inside clojure.core macros throw exception

2019-09-18 Thread 'David Bürgin' via Clojure
This is a known issue, see
https://clojure.atlassian.net/projects/CLJ/issues/CLJ-1966

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/20190918194827.GA15694%40azadi.


Re: Using :clojure.spec.alpha/invalid inside clojure.core macros throw exception

2019-09-18 Thread Peter Hull

On Tuesday, 17 September 2019 22:34:04 UTC+1, Daniel Dinnyes wrote:
>
> (let [x 42] :clojure.spec.alpha/invalid)
>
> That's an interesting one. It's failing the spec on the let's body, which 
is just 'any?' , so this is initially surprising.  
However s/valid? is implemented as, approximately, (not (invalid? (conform 
spec value)))
and (conform any? value) evaluates to value
(invalid? v) is implemented as (identical? ::invalid v)
so 
(valid? any? ::invalid)
(not (invalid? (conform any? ::invalid)))
(not (identical? ::invalid (conform any? ::invalid)))
(not (identical? ::invalid ::invalid))
(not true)
false

Whether this is a bug or not I can't say - it seems to be an inevitable 
consequence of the way spec is implemented.
Pete

-- 
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.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/clojure/48c0feca-9169-49e5-887c-8f4590985f43%40googlegroups.com.