mirror of
https://github.com/penpot/penpot.git
synced 2026-11-28 22:20:34 +00:00
Default is now no `!` for new functions. Existing `!` stays as legacy until its gradual refactor. Allowed cases live in clojure/idioms: mutating public app.db API and functions working over transients. Any further case must be registered there first. AI-assisted-by: muse-spark-1.3-contributor
1.5 KiB
1.5 KiB
Clojure Idioms (verified)
Behaviors confirmed against the language/stdlib — do not re-derive from assumption; a wrong assumption here already cost a review round.
int?is NOT 32-bit-only: true forLong,Integer,Short,Byte(fixed-precision integers). Clojure integer literals areLong, so(int? 5000)is true.integer?is the general integer predicate; prefer it when any integer kind must match,int?only when fixed precision is meant.awaitis acljs.coremacro asserting(:async &env): it fails at compile time outside an^:asynccontext, never silently.- The analyzer reads
:asynconly from the fn name meta and thefnoperator meta; list-level meta is ignored (would make a MetaFn).(fn ^:async [] …)puts the meta on argv (pre/post only, NOT async). - Valid:
(defn ^:async f),(defn- ^:async f),(^:async fn [] …)(the latter is what stockt/asyncgenerates itself). ^:asyncfns never throw synchronously (rejected promises instead);try/catch/finallysupported; continuations are microtasks, timers and RxJS schedulers are macrotasks (FIFO).!suffix allowed cases (only exceptions to the no-new-!rule inmem:clojure/design-rules): mutating publicapp.dbAPI (insert!,update!,delete!,run!,tx-run!,exec!, ...) and fns whose contract is to work over transients (stdlibconj!,assoc!,dissoc!,disj!,persistent!and custom helpers over them); any further case must be registered here with justification before use.