Comments (6)
Interesting, I did not realize ->
can be used this way. I do think this is somewhat uncommon and can easily be rewritten with fn
, which is only marginally longer but more clear IMO: (map (fn [x] [x]) [1 2 3])
. Of course someone who is used to this trick with ->
may find fn
version less clear, it's all subjective.
Most of the things that Joker catches would be caught otherwise once sent to and ran in REPL. I still find it very useful to be able to catch silly mistakes as early as possible and consider this the core value of Joker's linter mode. So I'd hesitate removing "no forms" check for threading macros. Perhaps it can be made optional. I've initially wanted to keep Joker's config file as small and simple as possible, but looks like more configurable linting rules are necessary in order to satisfy different people's needs...
from joker.
Sure, but it becomes worse with more args:
(map #(-> {:foo %2 :bar %1 :baz %4 :qux %3}) coll)
vs.
(map (fn [a b c d] {:foo b :bar a :baz d :qux c}) coll)
Anyway, this is subjective and not really the point. The point is that in this case linter appears to limit the functionality of the language and the "limitations vs. mistakes caught" ratio is not in its favor (unlike, say, checking for things like (is (= (should-return-false)) false)
in tests, e.g. one arg forms of =, >, < ...
).
from joker.
I also didn't know that anyone used threading macros this way, though I've occasionally used do
to achieve a similar effect. The symbols do
and ->
even have the same number of characters.
(map #(do [%]) [1 2 3])
(map #(do {:foo %2 :bar %1 :baz %4 :qux %3}) [1] [2] [3] [4])
from joker.
Most of the things that Joker catches would be caught otherwise once sent to and ran in REPL.
I've hit bugs where the threaded form updates some stateful thing and the error only crops up at some later point, so I appreciate the linting.
(->> things)
(mapv update-in-db!)
The :rules
configuration seems like a natural place to turn off these types of rules.
from joker.
This is addressed by 5b5375c: you can now turn off linting for this case by setting no-forms-threading
rule to false
(it's true
by default):
{:rules {:no-forms-threading false}}
Thanks @snoe, @rgdelato and @iafilatov for your input.
from joker.
Cool, thanks!
from joker.
Related Issues (20)
- Piping standard input to starting subprocesses HOT 2
- Embedded Joker HOT 3
- Support (load "filename") HOT 4
- format overwrite HOT 1
- Exceptions from :parse-fn w/ joker.tools.cli are not caught HOT 2
- disable auto-complete in REPL HOT 2
- Parsing Expression Grammar HOT 1
- `pprint` to file HOT 2
- large-forked-stdout Fails with Go 1.19rc2
- Ability to spawn child processes and send signals to them. HOT 17
- Invalid use of / in symbol name HOT 2
- File locking? HOT 3
- Surrounding text with parens in the REPL HOT 8
- Spurious lint error in cljs for `parse-uuid` HOT 3
- a_linter_all_data.go contains non-determinism HOT 1
- `joker.json/write-string` encodes an empty array as null HOT 3
- (let [foo nil]) crashes Joker 1.3.0–1.3.5 HOT 3
- Reading a fixed number of bytes from *in* HOT 2
- joker.base64/decode-string can't decode anything greater than or less than 160 characters HOT 4
- Test failures for Tumbleweed i586 HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from joker.