Static purity analysis.

89 views
Skip to first unread message

Christian Weilbach

unread,
Oct 15, 2017, 3:24:53 PM10/15/17
to clo...@googlegroups.com
Hey,

I have had finally the time to prototype an idea I had for over a year:

https://github.com/whilo/beichte

It is only a first prototype, but the basic mechanics work fine, i.e. it
is doing a deep recursive walk through your Clojure codebase (everything
that is on the classpath or filesystem) and tracks down impure var
accesses. I would like to get feedback of what you think about this and
would like see integrated if this becomes a linter.

I am thinking in the direction that you have to declare your vars as
impure explicitly, either by adding a "!" at the end of the function
name or by some metadata on vars (opt-out purity). This would allow you
to go as far as Haskell does in regard to enforcing purity without using
the type system and monads for it. This is not meant as a criticism of
Haskell, rather as a disentanglement of purity from the type system.

There will be a considerable effort needed in assigning purity to core
classes and methods and maybe also beyond Clojure to core libraries, but
maybe somebody has some ideas of how to ease this process(?).

Best,
Christian

signature.asc

Tiago Dall'Oca

unread,
Oct 15, 2017, 9:04:46 PM10/15/17
to Clojure
Haven't had time to look in deep but looks promising.

+1

I'd love to have more static analysis in Clojure and sometimes it feels like it's underrated (by the community). Just thoughts.

Keep up!
Reply all
Reply to author
Forward
0 new messages