This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2019-10-22
Channels
- # announcements (21)
- # aws (7)
- # beginners (105)
- # berlin (1)
- # calva (14)
- # cider (20)
- # clj-kondo (62)
- # cljdoc (7)
- # cljsrn (1)
- # clojure (206)
- # clojure-dev (2)
- # clojure-europe (11)
- # clojure-france (2)
- # clojure-italy (2)
- # clojure-nl (1)
- # clojure-uk (34)
- # clojured (1)
- # clojurescript (52)
- # copenhagen-clojurians (2)
- # core-async (1)
- # cryogen (3)
- # cursive (36)
- # data-science (27)
- # datomic (48)
- # emacs (1)
- # events (1)
- # fulcro (27)
- # hoplon (51)
- # jobs-discuss (1)
- # leiningen (1)
- # nrepl (2)
- # off-topic (52)
- # pathom (43)
- # quil (10)
- # re-frame (11)
- # reitit (28)
- # remote-jobs (2)
- # shadow-cljs (36)
- # sql (12)
- # tools-deps (7)
- # vim (32)
- # xtdb (17)
I have just played around with the current type checking. Nice work. How can I define the type of my own functions?
hey @whilo. that's documented here: https://github.com/borkdude/clj-kondo/blob/master/doc/types.md please note that this format is WIP and might change (although I hope not too much and I will document changes)
I think one problem that core.typed had was that too few people wrote type definitions. A possibly very restricted subset of spec would be better than having your own type definitions. A problem of this approach would be that it can limit the use of spec for users. The restricted definitions could be an overlay that automatically tries to use spec when there is no restricted type definition available. But you are more familiar with the details of spec, I assume I am idealizing a bit.
One problem with spec is that you cannot express a direct relation of the arity of your function and the return type.
Another problem is: spec is alpha, it might change. I'm not going to build on quicksand 🙂
There could be other more convenient formats that translate to this format of course
Another issue with spec is that there can be many indirections, specs pointing at other specs in other files. Hard to lint. Not impossible, but hard.
Spec is not designed as a language for expressing types, but more like a runtime contract system.
Spec is also not serialisable. I want something that people can put in an .edn file.
I have tried spec in the beginning btw, but these were some of the issues I had with it
Ok, I see. It is a bit peculiar that the development of spec takes so long and feels a bit intransparent.
yeah, I have talked to Alex about it. He mentioned they were going to maybe introduce a defn-like macro for specs. Once that's out and out of alpha, I'm keen on supporting that
I think it is not strictly necessary for a type system not to contain functions, which would be required to put into an edn file. Having a validating function definition could be meaningful if one can analyze its source as well.
Got a hello world version of clj-kondo.lsp working 🙂 Adding the real diagnostics can't be that hard now the plumbing is more or less there
@filipematossilva I'll probably publish the server part of clj-kondo.lsp using this: https://github.com/BrunoBonacci/lein-binplus It wraps an uberjar in a executable-like thing that works on any platform. Maybe that can also be used for the normal clj-kondo on Windows
ah I guess that's what clojure-lsp does?
yes that would work
I guess it ends up being the exact same thing as I'm doing, just one jar less
but I image your native images for osx/linux are still faster
FWIW windows user numbers are quite high, at least on the npm ecosystem
~50% of Angular users are on Windows for instance
I'm not downplaying the importance of Windows, I just don't know anything better right now 🙂
I think clj-kondo.lsp will help these users. The startup time for command line usage isn't much of an issue. It's the editor feedback that should be fast.
yes I know, just wanted to give perspective
I think there's a common perspective that windows users are a minority, but the reality ends up being different
that's a tricky one
although it would be accurate for survey respondents, they might not accurately represent the population
does maven provide download stats per OS?
that might be a more accurate, if it can filter out CI machines
@snoe Do you have Windows users of clojure-lsp? I just tried the lein bin plugin you're using with one of my own jars and it didn't run for me in a Windows VM
@borkdude there's been a couple, and I have a number of open issues around it, kinda hoping someone champions it cause it's difficult for me to get a handle on.
I'm experimenting with bundling a .jar file in a VSCode extension. I first tried the lein bin approach, but I got a 32-bit error in a Windows VM. java -jar does work
yeah, there's a few other older school things like jar2exe. I wanted to get ci running on azul to be able tot test them all
@snoe I can help you get github actions working
it has windows CI too
https://github.com/filipesilva/clj-kondo is running on github actions to test
@dominicm do you mean just running clj-kondo on github actions for CI, or a github action that runs clj-kondo on your code?
that I have never done
I think one problem that core.typed had was that too few people wrote type definitions. A possibly very restricted subset of spec would be better than having your own type definitions. A problem of this approach would be that it can limit the use of spec for users. The restricted definitions could be an overlay that automatically tries to use spec when there is no restricted type definition available. But you are more familiar with the details of spec, I assume I am idealizing a bit.
@filipematossilva what does the latter mean? I think I meant the former.
the latter means making a github action that is triggered by some event in github and performs some piece of code, in this case clj-kondo
a common usage of github actions is to automatically add/remove labels in issues/prs
the former means adding a github actions for CI check to your commits, where a series of commands is ran and status is displayed on PRs
if you want the former, it is mostly a matter of - deciding what OS you want it to run on - deciding on a way to install clj-kondo on that run - running clj-kondo
I can help you setup that, can you point me to your repo?
I wouldn't want to put you out :) I just wanted to poke around and see how that looked in practice.
Looks like this
And this is the definition