This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2016-12-07
Channels
- # adventofcode (38)
- # aleph (1)
- # bangalore-clj (3)
- # beginners (126)
- # boot (165)
- # boulder-clojurians (5)
- # cider (42)
- # cljsrn (11)
- # clojure (203)
- # clojure-greece (6)
- # clojure-hk (1)
- # clojure-italy (11)
- # clojure-new-zealand (1)
- # clojure-nl (1)
- # clojure-russia (112)
- # clojure-spec (86)
- # clojure-uk (176)
- # clojurescript (38)
- # code-reviews (2)
- # core-async (2)
- # cryogen (2)
- # cursive (16)
- # datascript (2)
- # datomic (80)
- # events (2)
- # garden (28)
- # hoplon (115)
- # jobs (1)
- # jobs-discuss (7)
- # klipse (50)
- # lein-figwheel (15)
- # liberator (17)
- # luminus (6)
- # off-topic (8)
- # om (31)
- # onyx (26)
- # parinfer (4)
- # planck (35)
- # protorepl (26)
- # quil (2)
- # re-frame (50)
- # reagent (21)
- # ring (5)
- # rum (2)
- # schema (1)
- # untangled (29)
- # vim (10)
- # yada (40)
Morning
@bigkahuna and given Clojure is hosted don't underestimate the value of knowing this!
I think I've asked this before but those of u using Spec, have u bumped your Clojure version to 1.9alpha or are u using a back port to an earlier version?
I ask cos I'm validating an api atm and I'm using schema as I don't want to introduce 1.9alpha
However a back port may introduce it's own risk depending on how well it's used/tested. Currently thinking stay with schems
@bigkahuna haha, mining beans š
I get to play with Clojure this afternoon.
W00t!
Swap the word āChristmasā for āClojureā in as many Christmas songs that you can think of...... š
@paulspencerwilliams sorry we didn't get time to catch up more at ClojureX. I still owe u a beer or 3 for the lift to West Midlands JUG
@jasonbell "Clojure Spec is coming to town"?
"I'm dreaming of a diverse Clojure community"
@paulspencerwilliams that one is so close to the truth I'm not sure whether to laugh or cry?
@agile_geek yeah. I did start to write "I'm dreaming of a white..." and then I thought about it and nah!!!
@agile_geek ClojureX was pretty diverse which is great. It's wonderful to hear so many accents, languages etc.
<dependency>
<groupId>org.ocpsoft.prettytime</groupId>
<artifactId>prettytime-nlp</artifactId>
<version>4.0.0-Final</version>
</dependency>
still fails for me... [ERROR] Failed to execute goal on project wat: Could not resolve dependencies for project wat:wat:jar:1.0-SNAPSHOT: Could not find artifact org.ocpsoft.prettytime:prettytime-nlp:jar:4.0.0-Final in central () -> [Help 1]
I was a little disappointed with our diversity count amongst the speaker... but it wasn't for want to trying. I'm open to suggestions about how we improve next year
@jasonbell are u using spec? If so, have you gone to 1.9.alpha?
Morning, @bigkahuna I think that needs to be 4.0.0.Final š
@petem @bigkahuna yeah, their 4.0.1.Final pom points to a 4.0.1-SNAPSHOT #DOH
@agile_geek personally no, but itās worth chatting to @otfrom and @tcoupland who have.
donāt let us stop you
Iāve only done a little spec, but Iād gladly hear more from someone who has
well, it would take me a while to type it all out, if only there was some sort of long form of Slack, but keeping the gushing over how it's allows data first development, the generative testing is so much better than it has been before (you can get some good pay off for your efforts, at last), test time enabling of data checks
this comes down to the fact that you can't round trip things through them, i.e. something that matches the spec, that is conformed, will no longer match the spec
they just aren't for using like coercers, it appears they really are just for helping with variadic fn args
glad I asked, that sounds worth knowing
@tcoupland with schema you would normally take something that may not match the schema and coerce it into something which does match the schema... and if it already matches it would be unchanged - how does spec/conforming differ ?
the clearest example is if you have a s/cat in your spec, a vector of values will match, but if you conform it, it will be turned into a map !
(s/def ::ingredient (s/cat :quantity number? :unit keyword?))
(s/conform ::ingredient [2 :teaspoon])
;;=> {:quantity 2, :unit :teaspoon}
it should'nt be a surprise, it's right there in the docs and everything, but, i for one, kinda of heard 'conform' and though 'coerce' and it takes a little while to get over that assumption.
Yeah me too. I think the choice of conform
as the fn name was very deliberate as it suggests to me bending something to fit a rule or specification.
and there's a difference between a specification and the data
that matches that spec
it seems almost like a āhigher-orderā data structure that describes the actual data structure
Yep. It's very meta. As I think of it, it's meta data wrapped around the data
@agile_geek, @seancorfield is using 1.9 alpha in prod, and to the best of my knowledge is very happy with it.
the other problem is just were to put these things, I've not had so much trouble with cyclic dependencies for years!
@tcoupland if you were to (s/conform ::ingredient {:quantity 2, :unit :teaspoon})
it would presumably remain unchanged ? so it's like maps are the archetypal structures ?
@dominicm cheers really useful to know. I think I may stick with Schema as I can't unilaterally enforce a version change on 25 other developers...especially when I'm just a contractor brought in to ship code.
@mccraigmccraig that's my understanding
@mccraigmccraig not quite
oh, i see - so conform
is really a way of extracting the named fields from the given structure in map form
i'm going to say 'yes', but you can make it do a lot more that that, with custom conformers
you can get very close to it working like coerce, but your playing with fire by doing it, as that is not really it's motivation
I guess the intent is to provide a canonical representation for the data that conforms to a spec?
yeah, i can see the utility
My (limited) experience is that spec is excellent in it's domain (function arguments, macros), but isn't suited outside that domain. E.g. Form validation, anything that touches the db,
@dominicm interesting. What makes you say that?
i guess i'm not going to be ditching schema anytime soon though - i use it quite heavily for coercing JSON off of the network
@agile_geek my interest in data specifications comes from user facing mostly. My litmus test is a registration form. With spec you can't pass in lookup information, like A database connection, and use s/keys, to validate that the email is unique. The other case it can't handle is fields where checking must be done across multiple keys (password, password-confirmation) but the error must be attached to password-confirmation - so you can no longer use a generic parse for errors.
Cool. Makes sense
Just what I was thinking
I think we would be 'complecting' multiple concerns if they did
I don't think spec or schema's motivation is cross field validation for example. They are more active documentation and runtime type checking in my mind but happy to be proved wrong as my experience with both is very limited.
Anyway, this conversation is too fascinating and distracting me from work so back to the grindstone...but keep posting and I'll catch up with thread later
To me, I want a single format to describe my data. That's how you create a series of filters where the first layer doesn't create something which conforms to the second layer, but you can't convey errors from the second layer back to your user. I have one concept of a registration form in my application. I don't think checking it with vlad and then spec provides any value. I want to be able to describe it ONCE, and then use it as I need (form validation, generation, function arguments, etc)
I'm not saying that my data validation library should know how to generate html necessarily, but it should be simple to write that extension.
@dominicm that sounds like a lot of concerns in one thing to me, but my use cases are a bit different
representing a data model and accepting+coercing user input into said data model are (imo) slightly different but related goals
sure - but it doesn't sound unreasonable to want to use the same representation of model for both purposes
The tool that provides my model doesn't even need to know about all uses, if sufficiently easy to parse it should be possible to interact with my model in an infinite number of ways.
@glenjamin dyu mean that the edge cases in these few implementations don't overlap, or that there is some fundamental reason why the required edge cases can never be satisfied by a single implementation ?
for instance, with a data modelling hat on, āthis field must be equal to this other fieldā is a bit silly - youād just normalise and remove the second field
i'm not thinking that all the form-validation requirements should be satisfied by a data-modelling lib - but that a form-validation lib should be able to build upon the provisions of a data-modelling lib without requiring me to re-specify a bunch of stuff which is already adequately specified seems reasonable
I would imagine youād use spec to model your internal āuserā data structure, and the registration form would use something slightly more validation focused, and then once registration validation is passed youād assemble the user
that seems sane. i'm a bit disappointed that you can't use spec to coerce the user back to it's true form after passing it through a type-hostile network format like JSON though
could be. i am a spec n00b though, so i don't really know -just going by what was said above
Swagger parsing exists, but it requires that all your specs look like:
(s/and str? my-custom-pred)
So you have to pollute your specs with a subset of predicates that can be understood.
This is also required for test.check, so maybe it's only me who's bothered by this. test.check works by generating random strings, and seeing if they match the second predicate. Spec has built in mechanisms for specifying a custom generator. It's not generic though, so doesn't apply to other use cases outside generators.
going to change tack here a little, i've got an annoying problem, maybe someone can help
uploading files to a webserver, there are some required headers, when they aren't present I want to return a 400. Simple you say
however, what seems to be happening, is the clients are just reacting to the socket closure and not seeing that they have a response to read
as the server is, quite rightly in my view, closing the socket once it has responded with the 400 and not bothering to read the rest of the upload
HTTP/1.1 400 Bad Request
< Content-Length: 478
< Content-Type: application/json
< Server: Aleph/0.4.1
< Connection: Keep-Alive
< Date: Wed, 07 Dec 2016 12:20:08 GMT
* HTTP error before end of send, stop sending
<
{"status":400, etc, etc]
but, http-client just throws a SocketException and http-kit just seems to hang until the request gets timed out.
i'm just about to try and quick hack of http-kit's client to see if it does have the response on timeout, might be able to fashion a real solution from there, but i'd rather not have to do that š
i haven't had that trouble - server behaviour is entirely reasonable though, and presumably since the server couldn't close the socket until after it had written its 400 response, the 400 response should be buffered and readily available for the client to return if it wasn't throwing its toys out of the pram because the socket was closed
have you tried aleph's http client ? i've been using it plenty and the experience has been good - though i haven't deliberately exercised it in this particular way
why not ?
well, now it means i'm going to have to probably install a java ide for the first time 4 years, to do a real fix
haha, good luck
intelliJ has a free edition which is v. powerful (esp. for Java)
Iām surprised aleph doesnāt do multi-part - I thought yada did, and I thought yada ran on aleph
yada does do multipart server handling @peterwestmacott , but it's all yada not aleph
gotcha, thanks for clearing that up
i imagine aleph client would be fine if you did your own multipart encoding and POSTed that, but it's certainly nicer to have your http client look after such details
@otfrom I must try meghanada-emacs sometime. Tried jdee about 18 months ago and found it lacking..Moot point in my last client as even IntelliJ was 'illegal'!
dare i ask what was 'legal' @agile_geek ?
I'll give you a clue: It blocks out the Sun
Actually, it wasn't even that IDE...it was a 'hacked' version that had stuff to allow you to test without Websphere as IBM charge $1M per user license*
* OK slight exageration
huh, crazy hippies wanting to test without websphere
IntelliJ Idea for Java, Emacs for Clojure. I tried IntelliJ for Clojure and got annoyed really quickly.
Whenās the CFP @agile_geek ?
@jasonbell, really? with Cursive I find IntelliJ great for Clojure - of course it stops being free then...
@peterwestmacott well there's the element to take into account š then the CIDER element and I used to be an Eclipse user in years gone by. Emacs works for me now, just took a bit of time to get there.
i did try cursive, a while ago, it gave me night terrors, reminded me of eclipse to much
i found the lack of consistent key bindings across all the different panes the real killer
@jasonbell dont know yet. Probably not until June/July
IDEs are very subjective. Iāve tried IntelliJ multiple times, across many different versions, and thereās just something about it I canāt grow to like. I used Eclipse/CCW for a while when I was first working with Clojure (I was used to Eclipse for other language stuff prior) but I made the jump to Emacs (well, back to Emacs after a 20 year gap!) and have been very happy since. That said, Iām trying Proto REPL (Atom) right now b/c of Jason Gilmanās talk at Conj.
The graphing stuff in ProtoREPL was very impressive last time I looked (really want to steal it & integrate into nyaovim or something). Has it gone further (I have no internet to watch a talk :()
IDEs are really necessary for ent java. I'm also trying out proto-repl at the moment. Its working well except I just cant get used to Parinfer. Just got to remember to switch to Paren mode!!
@jasonbell yeah bl**dy tyranical CTO's eh?
I think calling them "necessary" is very dangerous. They are necessary because no better plugins have been written yet.
@agile_geek I could not possibly comment
IMO the killer features for Java are refactoring support and a debugger you can hook into a socket (with the later you don't need plugins to simulate your runtime container just enable debug listening on a port and hook in....assuming the app server you're running on is not a massively expensive proprietary beast....bl**dy WAS...grumble)
@jasonbell I aspire to being a tyrant. If you talked to Fi at ClojureX you'll know that I was the CTO that just acquiesced to everything she said!
I used Eclipse for many many years.... for obvious reasons.. At last years EuroClojure @cdpjenkins and I explained to Colin Fleming why we weren't using IntelliJ and he thought that was the best reason he had heard so far.
and I have been using Atom as well for quite some time.. I really like parinfer and after having watched the Conj talk I need to look more into it.
And things like RTC integrate fairly well with Eclipse and I don't think there is a plug in for IntelliJ (but could be wrong)
One of the projects I was one we used both ant and the eclipse tool... two things to maintain was quite a pain.
I had to use either Eclipse or IntelliJ at last client (once IntelliJ was sanctioned...yes I wish that was in the sense the CIA mean!) @tcoupland Found that you can switch to Emacs key bindings for both, but it completely freaked out anyone I paired with!