This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-12-17
Channels
- # adventofcode (33)
- # announcements (1)
- # beginners (32)
- # calva (12)
- # cider (1)
- # clojure (73)
- # clojure-belgium (1)
- # clojure-europe (20)
- # clojure-norway (3)
- # datomic (3)
- # emacs (2)
- # fulcro (18)
- # graphql (11)
- # honeysql (1)
- # juxt (1)
- # lsp (10)
- # membrane (13)
- # reitit (1)
- # releases (5)
- # scittle (15)
- # spacemacs (1)
- # squint (36)
- # testing (1)
- # tools-deps (20)
- # xtdb (5)
Transaction docs say what happens when transaction functions return false
or a list of new operations, with a note that they should return a list or false. https://github.com/xtdb/xtdb/blob/master/test/test/xtdb/tx_test.clj shows that actually nil is also tested for, but is this something that might change in the future? And finally, returning true
is not tested at all so I suppose it really is undefined behaviour. But it seems counterintuitive that transaction functions that work purely as pre-conditions need to return nil/false, and that they mean the opposite thing. Usually nil would be either unacceptable or be considered falsy. And it's also counterintuitive, that boolean is not a valid return type when false is.
My first thoughts would be that nil should raise an error, to avoid treating mistakes as explicit results, and the valid return types would be booleans and seqs (or vectors, but list seems just wrong since very few things actually return lists), with true meaning just continue, false to abort, and the seq to add more processing.