Fork me on GitHub

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: please note that this format is WIP and might change (although I hope not too much and I will document changes)


What would be necessary to derive these type definitions from spec?


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.


If this is unclear I can rephrase it.


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 🙂


Also, the current format is mostly designed for one pass, speed


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.


These issues make sense, could you talk to some spec developers about them?


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

👍 2

@filipematossilva I'll probably publish the server part of clj-kondo.lsp using this: 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

Filipe Silva13:10:01

ah I guess that's what clojure-lsp does?

Filipe Silva13:10:08

yes that would work

Filipe Silva13:10:24

I guess it ends up being the exact same thing as I'm doing, just one jar less

Filipe Silva13:10:10

but I image your native images for osx/linux are still faster


yes, that wrapped jar executable would only be for Windows


until GraalVM sorts things out for Windows

Filipe Silva13:10:17

FWIW windows user numbers are quite high, at least on the npm ecosystem

Filipe Silva13:10:33

~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.

Filipe Silva13:10:06

yes I know, just wanted to give perspective

Filipe Silva13:10:39

I think there's a common perspective that windows users are a minority, but the reality ends up being different


I'd like to see Windows % in the next Clojure Survey

Filipe Silva13:10:33

that's a tricky one

Filipe Silva13:10:54

although it would be accurate for survey respondents, they might not accurately represent the population

Filipe Silva13:10:49

does maven provide download stats per OS?

Filipe Silva13:10:04

that might be a more accurate, if it can filter out CI machines


clj-kondo is published to clojars. not sure if it has those stats


@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


Is anyone using clj-kondo with Github actions and has that process documented?

Filipe Silva19:10:24

@snoe I can help you get github actions working

Filipe Silva19:10:35

it has windows CI too


oh perfect

Filipe Silva19:10:55

@dominicm do you mean just running clj-kondo on github actions for CI, or a github action that runs clj-kondo on your code?


I think he means the latter

Filipe Silva19:10:38

that I have never done


@filipematossilva what does the latter mean? I think I meant the former.

Filipe Silva21:10:19

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

Filipe Silva21:10:51

a common usage of github actions is to automatically add/remove labels in issues/prs

Filipe Silva21:10:25

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

Filipe Silva21:10:10

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

Filipe Silva21:10:51

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.

Filipe Silva22:10:45

Looks like this

Filipe Silva22:10:13

And this is the definition