6

Journal 2019.16 - closed spec checking

 4 years ago
source link: https://insideclojure.org/2019/04/19/journal/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Closed spec checking

As I mentioned last week, I’ve been working on adding a new form of closed spec checking and that’s in master for spec 2 now, or at least the first cut of it. The idea is that you can mark one or more (or all) specs as “closed” and they will then act in that mode for valid?, conform, and explain until you open them again. The specs themselves are unaltered - there is no marker in the symbolic spec form indicating “closed”-ness, rather this is a checking mode that you can turn on, kind of like instrument.

(require '[clojure.spec-alpha2 :as s])
(s/def ::f string?)
(s/def ::l string?)
(s/def ::s (s/schema [::f ::l]))
(s/valid? ::s {::x 10})  ;; "extra" keys are ok
;;=> true

;; now "close" the ::s spec (no-arg arity closes all specs)
(s/close-specs ::s)
(s/valid? ::s {::x 10})
;;=> false

(s/explain ::s {::x 10})
;; #:user{:x 10} - failed: (subset? #{:user/f :user/l} (set (keys %))) spec: :user/s

;; now open again
(s/open-specs ::s)

(s/valid? ::s {::x 10})
;;=> true

Still a lot of open questions about the API, behavior, etc, but this should give you an idea.

Clojure 1.10.1

We had some good feedback at the beginning of the week on Clojure 1.10.1-beta2, particularly about the error reporting aspects which go to a file. I continue to think that the default of writing to a temp file is best, but grew unsatisfied with the configurability of what was there, which was only a new clojure.main option. Instead of having a flag, decided it should be an enumeration of options - file (for temp file), stderr, and none. Also, having it just as a flag on clojure.main meant that every external launcher didn’t know how to do that, whereas making it a Java system property is already a configurable path that these tools (like Leiningen) can already handle. So, I made it check Java system property, then optionally override from clojure.main flag, and default to file mode. This is all captured in CLJ-2504 which I expect will go through screening next week.

I’m also growing a little concerned at the number of people patching around CLJ-1472 for Graal so will probably discuss that with Rich and consider whether to do anything for 1.10.1. The proposalss are tricky and may have unexpected perf impacts so its a difficult one to assess.

In any case, we would like to bring this release to an RC soon and get it released.

Rich has a couple api additions he put together this week related to metadata retention and those will get slotted in once we’re looking at 1.11 again.

Other stuff I enjoyed this week…

I haven’t had many music recommendations lately as I went through a bit of a dry spell. But I listened to a lot of music this week! My son is a drummer and has been doing an Aretha Franklin / Stevie Wonder show recently so it’s been a lot of fun watching him listen to a lot of stuff I’ve loved for a long time but that’s new to him. So many great tracks on Songs in the Key of Life, but he’s particularly digging on Sir Duke and the oddball Contusion this week.

In newer music, I really dug Lay Back by CLAVVS (pronounced “claws”), that’s from a 3-song EP and I like all 3 tunes on that.

I also want to give a shout-out to Stuart Sierra’s new podcast No Manifestos - the first 3 episdodes were all great! I really enjoyed listening to them.

Also, outside the Clojure world I run this little conference called Strange Loop - the CFP is open now, please submit!


Recommend

  • 48

    spec I spent almost the entire week completing the large chunk of refactoring I’ve been doing in spec-alpha2. At this point, I think everything is put back together. I’ve updated the

  • 60
    • www.tuicool.com 6 years ago
    • Cache

    Journal 2019.12 - Clojure 1.10.1-beta1

    Clojure 1.10.1-beta1 The big news this week is the release of Clojure 1.10.1-beta1. This is a tightly scoped release and we are not expecting to add much, if anything, more to it before it’s released. There are...

  • 39

    I’ve been fighting some bronchial stuff this week so didn’t quite get a full week in, but there are a couple things to talk about. Clojure 1.10.1-beta2 This week we released

  • 47

    Clojure Confluence We’ve been using a Clojure Confluence wiki (graciously provided by Contegix ) for a long time. However, it has not been actively used in quite some time...

  • 39

    Clojure 1.10.1 work Stu screened and I updated CLJ-2504 headed for a 1.10.1-beta3. That probably won’t happen till early next week due to travel. T...

  • 35

    Hey all, I’m a little off rhythm as I’ve had some vacation time recently, but now is a good time to check in! Clojure 1.10.1 Today we released

  • 13

    Journal 2019.25 - dep graphs, s3 transporter, spec 2 Probably the last update of the year. I had hoped to do it this weekly in 2019. That didn’t quite happen but since this is the 25th update of the year, I average about...

  • 9

    Journal 2019.24 - spec and-, tools.deps.graph I’ve fallen off the pace on these journals but here’s an update! Spec 2 Most fresh in my head is some ongoing work on Spec 2. This week I added s/and-...

  • 9

    Journal 2019.9 - jdk regression, clojure.main, spec JDK regression Following up on this from last week, I had the idea that maybe moving all of the cod...

  • 10

    Journal 2019.7 - jdk regression, spec, sets, tools.deps JDK regression There was a rash of reports this week about significant startup time slowdowns after switching to the latest version of Java 8 and 11. I tr...

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK