Giter Club home page Giter Club logo

clojure-future-spec's Introduction

Here are a few projects I worked on.

Fonts:

Apps:

  • AnyBar: universal macOS menubar status indicator

Java libraries:

  • Skija: Bindings for Skia, a graphics library
  • JWM: Cross-platform window management

Clojure libraries:

Sublime Text:

  • Clojure Sublimed: Clojure support for Sublime Text 4
  • Executor: Run any executable from your working dir in Sublime Text
  • Writer: Color scheme for focused long-form writing

Alabaster, a Minimalist Color Scheme:

Keyboard layouts:

  • Universal: EN/RU reimagined to be used together

clojure-future-spec's People

Contributors

cddr avatar jetmind avatar taylorwood avatar tonsky avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

clojure-future-spec's Issues

alpha12 fails with "UnsupportedOperationException nth not supported on this type: PersistentArrayMap"

The following works with alpha11, but not alpha12:

(require '[clojure.spec :as s])
(require '[clojure.future :refer :all])
(require '[clojure.spec.test :as stest])

(s/def ::n nat-int?)
=> :user/n

(s/fdef sample
        :args (s/cat :some-map (s/keys :req-un [::n])))
=> user/sample

(defn sample [some-map]
  some-map)

(stest/instrument 'user/sample)
=> [user/sample]

(sample {:n 6})
UnsupportedOperationException nth not supported on this type: PersistentArrayMap  clojure.lang.RT.nthFrom (RT.java:947)

With alpha11:

...
(sample {:n 6})
=> {:n 6}

Upstream libs break when using clojure.future.

This issue onyx-platform/onyx#782 came up when an upstream lib is still using clojure 1.8 and a downstream project has already moved to 1.9.

I think we could add a (defmacro refer-future! [& syms]) macro that would define everything from clojure.future if it detects that they haven't already been defined (presumably because you are running clojure 1.9). The upstream lib calls (refer-future! any? uuid?) instead of putting that in the ns. I think this would keep warnings/errors from popping up downstream.

Alternatively we could make a file clojure.use-future that conditionally defines everything in clojure.future and you can then put clojure.future in the :use clause in the ns of the lib.

cljc / cljs.spec.alpha

This might be a big request, but having this same functionality for ClojureScript would be phenomenal.

Clojure spec split in alpha16 into spec.alpha breaks the same code in 1.8/1.9 approach

I have recently converted a library zprint to work with spec in both 1.8 and 1.9-alpha15, using clojure-future-spec to make 1.8 compatible (from a spec viewpoint) with 1.9. It has worked great, and I have been delighted with how easy it was to build a library that had the same code in both 1.9 and 1.8 and used spec. In 1.9-alpha15 it uses the "built-in" spec, and in 1.8 people have to add clojure-future-spec as a dependency, which is a small thing. Thank you so much for creating this library so that we can use spec in both versions!

Of course, now things have changed and the namespaces for spec have all changed in 1.9-alpha16. This breaks my "one library works in 1.9 or 1.8" approach, since the "works in 1.8" part requires that the namespaces in clojure-future-spec be the same as the namespaces in 1.9-alpha16.

That said, now that spec is a library, it would seem that I could just add it as a dependency for my 1.8 code and use that. But in the announcement, Alex said that spec wasn't going to support 1.8 since it uses new functions that only exist in 1.9 (and in clojure-future-spec). I tried various approaches to adding clojure.future as a dependency and requiring it, but I can't even get that to work by adding it to the (ns ...) because the spec.alpha code looks for the new functions explicitly in clojure.core (via an alias). I don't see a way around that, but if there is one, I'd love to hear about it.

Even if that worked (which it doesn't for me), I don't know of a way to get the clojure-future-spec clojure.future namespace loaded along with the new spec libraries only in 1.8 and not have it throw an error in 1.9. There might be a way to put the require in a (try ... catch), but I can't even try that because it doesn't work at all the way things are now even with the require in the (ns ...) declaration.

I'm hoping that at some point you will back-port the latest 1.9-alpha16 spec stuff for 1.8, as you have before with the alpha15 code.

It has been really great to have one spec that we can use in both 1.9 and 1.8. Thank you for making that possible. I really appreciate it, and I know I'm not the only one!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.