For a list of breaking changes, check here
SCI: Configurable Clojure/Script interpreter suitable for scripting and Clojure DSLs
SCI is used in babashka, nbb, clerk, joyride and many other projects.
- #817: mutation of
deftype
field should be visible in protocol method - #816: restore recur target exception in do
- #819: don't use metadata in record implementation
- #831: preserve location of
throw
in stack trace - Drop name metadata from conditionally defined var
- Implement
in-ns
as function rather than built-in (@SignSpice) - #832: reload analyzer API within CLJS to ensure
ns-publics
andresolve
are available - Optimize analysis and evaluation of
fn
- Add more docstrings to built-in (core) macros and vars (@mhuebert)
- Add
array
- Performance optimizations for
let
(up to 8x faster) - babashka/babashka#1340: Add arglists/docstring to protocol methods (@bobisageek)
- #801: preserve location metadata for vars defined in macro-expansion
- Add new
var->symbol
API function insci.core
- Add new
resolve
API function insci.core
- Expose
*print-namespace-maps*
fromsci.core
(@ghoseb) - Internal simplifications for
and
,or
anddo
- #791: Fix friendly arity exception messages for Clojure 1.10, 1.11 (@lread)
- #794: Support for
IPrintWithWriter
for custom types in CLJS - Add
ns-unalias
(@eerohele) - Resolve record name with dot:
Foo.
- Implement
addWatch
/removeWatch
noops on SCI vars to prevent segfault in native images - Improvements to error locations in exceptions
- Fix type hints on locals with same names (@lread)
- Add
demunge
in CLJS (@sirwobin) - #785:
satisfies?
finds protocols that have no methods (@lilactown) - #781, #782 and #783: extend protocols to JS built ins using CLJS "type symbols", fix extending protocols to default and
Object
(@lilactown) - Add
keyword-identical?
in CLJS - Fix
deftype
mutable fields for CLJS sci.ctx-store
: a place to store the context so it's available forsci.configs
to use. See docs.- Make loading
cljs.analyzer.api
more reliable - Don't partial-ize ctx-needing vars that aren't built-in
- #774: make interpreter stacktrace available on exception if annotated with
^:sci/error
- Allow unrestricted access with
set!
in CLJS ifsci.core/enable-unrestricted-access
has been called. - Don't eval metadata on
defn
expression - Add
hash-combine
- #729: mutable fields in deftype
- #767: Reduce advanced compiled JS output with about 20% (~900kb -> ~740kb)
- #768: copy
:dynamic
metadata incopy-ns
- #771: Fix
or
with more than 20 args
- Fix
sci/copy-ns*
, the name was not copied correctly :(
- Support globally valid
:ns-aliases
for mapping e.g.clojure.test
tocljs.test
- New
copy-var*
API function - #755: make
sci.lang.Var
part of public API - #755: make
sci.lang.Namespace
part of public API - Add
add-namespace!
API function - Fix invalid arity problem in CLJS macros with arity >= 20
- Bump edamame to v1.0.0
- #762, #731: print via global
print-method
andprint-dup
methods, don't allow by default - #733: do not allow to change meta on built-in macro
- Various
defrecord
improvements (equality, metadata preservation) - #738: dotted simple symbol should remain unresolved
- #741: preserve closed over value analysis when using fixed + varargs arity
- #739:
satisfies?
does not recognize marker protocol on record - #740: simple-dispatch on records
- #743:
satisfies?
of marker protocol viaextend-
{type
,protocol
} - #744: syntax quote for records should return class representation
- #745: syntax quote of imported class
- #747: provide default pprint impl for SCI records
- #748: fix async refer
- #757: fix simultaneous async evaluations
- Record types are now an instance of
sci.lang.Type
- #763: record in syntax quote resolves to
sci.lang.Type
- #751: defprotocol returns symbol
- #711: support
*print-dup*
- #712: destructuring in protocol impl not working
- #715: allow property access on vars in CLJS
- Add
->Eduction
- Expose
print-err-fn
in SCI core API - add
:name
metadata via helper functions and use metadata for var names - Improve error reporting for
let*
andtry
- #714: Improve instance member call parity with Clojure/JVM
- Default
*read-eval*
/sci/read-eval
to false - Expose
all-ns
andfind-ns
insci/core
- Fix for
copy-ns
when var has no metadata - Add
add-class
andadd-import
API functions insci/core
sci.async
: EXPERIMENTAL namespace for async evaluation in CLJS
- Restore compatibiliy with self-hosted CLJS (e.g. planck)
- Add CLJS
*print-err-fn*
var
- #382: Add
*clojure-version*
and(clojure-version)
- Support
:sigs
on protocol map - Add
unchecked-dec
- #689: Reified object doesn't get handled for fallback protocol impl
- #692: extending
Object
with protocol doesn't work on records - #693: extend protocol to
IRecord
doesn't work on SCI records - #695:
(identical? [] [])
works - #700:
loop
doesn't expand in fully qualifiedlet
- #696: add
let*
special form - #702: require
cljs.analyzer.api
forsci/copy-ns
- #665: expose
*assert*
- Drop location metadata from symbols
- #687:
declare
as macro - #684: support
print-method
on records
- Fix #680: allow expression in class position of
new
in JS targets - Performance improvements
- #416: mutable arrays for bindings. Takes care of approx. 2-4x speedup in loops (depending on environment).
- Performance improvements for varargs function invocations.
- Remove
:disable-arity-checks
option. Arity checks are now always taken care of by the host environment and SCI does not do any special handling. This means that in JS environments there will be no arity checking regardless of this option. This change was introduced for better performance.
- Feature: add
halt-when
,pop!
,array?
,js-delete
,object?
andundefined?
- Feature #616:
:as-alias
support - Fix #498: Cannot recur from non-tail position
- Fix #653: Improve error message for higher order function arity exception.
- Fix #655:
merge-opts
should overwrite existing var - Fix #660: In JS you can throw and catch anything
- Fix #664: cannot take value of macro
->
- Fix #659: meta evaluation order (@erdos)
- Fix #666: use
js/Reflect
when calling instance function, adds compatibility with GraalVM JS Polyglot - Fix #673: use
js/Reflect
when calling constructor, adds compatibility with GraalVM JS Polyglot - Fix #677: Fix
macroexpand
fordefrecord
- Fix function with arity 15
- Fix macro which expands in
defrecord
+ protocol which invokes record constructor
- Prefer metadata implementation override over
extend-protocol
#378 - Prefer metadata implementation in
extend
extend-protocol
#378 - Make constructors in CLJS more dynamic #624
- Support Object toString override on defrecord #627
- Bump edamame to
0.0.18
- Add
copy-ns
macro clojure.core/read
improvements #663clojure.core/read
can read with standardPushbackReader
- Support
*read-eval*
- Support
*default-data-reader-fn*
- Support
*reader-resolver*
- Intern fails to rebind a referred var if already present in config #637
- Support adding protocol for satisfies check #638
- Add
reader-conditional?
- Add CLJS
random-uuid?
- Add
clojure.test/test
- Expose
doseq
andfor
as normal macros (@erdos) - Fix
declare
with dynamic var #630 (@erdos) - Support
ns
:require
with string instead of symbol (@djblue) - Add
inst-ms
- Fix
resolve
on class method (should returnnil
) #647 - Support getting instance fields from JVM classes
- Add
to-array-2d
,aclone
,reduce
andamap
#650 (@MrEbbinghaus)
This release focuses on:
- Improvements regarding CLJS compatibility (interop, js literals, printing via
*print-fn*
) - Adding more dynamic vars related to printing
- Exposing
sci/stacktrace
andsci/format-stacktrace
for getting a stacktrace from a SCI exception. This allows you to build an error report like babashka and similar tools built with SCI.
The changes per issue:
- Fix function reference equality #587
- Don't convert Clojure values to JS values automatically in interop #602
- Calling comment with 49 (or more) args fails in CLJS #603
- Fix stacktrace for invalid import #589
- Add
js-keys
- Support
create-ns
- Varify more core vars (@bobisageek)
- Fix constructor call of class added via imports
- Keep
:disable-arity-checks
after merge-opts - Add
*flush-on-newline*
- Add
*print-readably*
- Support
:clojure.core/eval-file
metadata - reify form from macro doesn't evaluate correctly #609
- Handle js literals in the same way as ClojureScript #610
- Control printing in CLJS via
*print-fn*
and via APIsci/print-fn
rather than*out*
#365 - Make stacktrace logic public #590
- Use
IllegalArgumentException
incase
when providing duplicate dispatch values - Improve error message when protocol not found for class
- Add
thread-bound?
predicate #560 - Allow
set!
to mutate objects in CLJS #563 - Experimental
SCI_ELIDE_VARS
environment variable for smaller CLJS bundle size - Support trailing metadata in
defn
#567 - GC improvement: don't hang on to all external bindings in closure
- Several performance improvements
- Expose
intern
in core API - Several fixes regarding
try
/catch
in CLJS #583, #584, #585 case
expression generated by macro doesn't work correctly #586
- Fix metadata on non-constant map literal expression #546
- Support
:reload-all
#552 - Support new kwargs handling from 1.11.0 #553.
- Allow dynamic
:doc
ondef
/defn
#554. - Fix metadata on nested evaluated map #555
- Bug with protocol methods in record where later arg overrides "this" #557
- Support :rename in :refer-clojure #558
- Add
aset-...
,delay?
,bit-clear
- Add
bound-fn
andbound-fn*
- Add arg count check for
clojure.core/for
- Detect cyclic load dependencies #531
- Add
force
- Add
dissoc!
(@wilkerlucio)
- BREAKING: Do not merge ex-data into sci error #534 (@GreshamDanielStephens)
- Pick fn arity independent of written order #532 (@GreshamDanielStephens)
(instance? clojure.lang.IAtom 1)
returnstrue
#537- Fix
ns-unmap
on referred var #539
- if with falsy literal returns nil #529
- Fix error reporting in case of arity error #518
- Shadowing record field names in protocol functions #513
- Fix destructuring in protocol method for record #512
- Faster processing of maps, sets and vectors #482
- Prioritize current namespace vars in syntax quote #509
- Fix ns-publics to not include refers #520
- Add
refer-clojure
macro #519 - Syntax quote resolves referred var incorrectly #526
- Priorize referred vars over vars in current ns #527
- Improvements for using
type
ondefrecord
#492 - Deref vars at analysis time that have
:inline
metadata in Clojure #483 - Keep only location metadata for seqs and symbols #488
- Conditionally defined vars should not have metadata #496
- Fix interop on map #506
- Performance improvements #500, #502, #504
- Fix shadow-cljs warnings #499
Thanks for contributing to this release:
@lread, @patrick-galvin, @SevereOverfl0w, @djblue, @kwrooijen, @sogaiu, @joinr, @RickMoynihan, @galdober
- Removed
:realize-max
and:preset :termination-safe
. In the light of #348 it would be misleading to claim that sci can guarantee termination within reasonable time.
- Add
class?
,iterator-seq
,remove-watch
,realized?
,clojure.walk/macroexpand-all
,find-var
,lazy-cat
,bound?
,*print-namespace-maps*
,get-thread-bindings
,var-get
,var-set
,with-local-vars
- Add
fork
API function #369 - Add API functions for parsing code and evaluating forms:
sci.core/reader
,sci.core/parse-string
,sci.core/parse-next
,sci.core/eval-form
#404 - Support implementing
IDeref
,IAtom
,IAtom2
(and CLJS equivalents) #401 - Add API vars
print-meta
,print-level
which can be used withsci.core/binding
to control the dynamic var equivalent in sci programs - Support calling
symbol
on a var #453 :disable-arity-checks
option: when used, sci behaves similarly to CLJS/JS by not checking the provided number of arguments and allowing less or more for single and fixed arity functions #460
- Alter-var-root uses thread-bound value to update #359
- Eval metadata on var created with defn #371
- Metadata fn on var f fails if referring to f #363
- Fix missing protocol methods #367 (@patrick-galvin)
- Support multiple methods of protocol on defrecord
- Allow re-binding of core vars with clojure.core/with-redefs #375
- Fix false dynamic binding #379
- Don't eval record returned from reader function #386
- Implement
->
andas->
as normal macros #390, #462 (@kwrooijen) defn
should not introduce local for name in body #384- Fix wrong arity in error message when calling macro #392
- Throw when trying to redefine referred var #398
- Fix for
use
120175f - Fix importing protocol classes from namespaces with hyphens #410
- Performance enhancements #415, #452, #468, #470, #472, #473, #475, #478, #480
- Support top-level do emitted from macro #421
- Support map constructor for maps #431
- Partial support for multiple reified classes 323a257
- Fix calling literal symbol babashka/babashka#622
- Allow user-defined vars when def is allowed #434
- Fix default destructuring with false #436
- Fix reflection warning in multimethods code #437 (@galdober)
- Support nested libspecs #399
- Aliases in protocol functions should work #440
- Allow users to override :line metadata #443
- Support second arg (env) in
resolve
- Preserve and eval reader meta on coll literals and functions #447, #448
- Fix #js object reading #449
- Support unmap for imported classes #432
- Fix for reader conditional parsing borkdude/edamame#65
- Dotted field access for JS interop #450
- Syntax checks for binding #458
- Add
boolean?
to constant check #465 (@kwrooijen) - Check macro var value at analysis time #467
- Excluded clojure var still gets resolved to in syntax quote #466
Thank to @jeroenvandijk, @jjttjj, @justone, @sogaiu and @armincerf for contributing.
- Implement hierarchies (
derive
etc.) #237 - Implement multimethods #236
- Add
ns-interns
,ns-imports
,ns-refers
,ns-map
,all-ns
- Add
do-template
- Add
clojure.edn
namespace - Add
promise
anddeliver
(@jeroenvandijk) - Add
:readers
option to support data readers (@jjttjj) - Add
tagged-literal
- Add
when-some
andif-some
(@justone) - Add
re-matcher
- Add
re-groups
(@sogaiu) - Implement
read-string
+eval
#285 - Add
ns-unmap
(@sogaiu) - Support
*print-length*
#294 - Add
while
macro #296 - Add
clojure.repl/find-doc
#304 - Add
clojure.repl/apropos
#317 - Add
memoize
- Add
load-string
#307 - Add
clojure.repl/pst
- Add
with-bindings
macro #289 - Add
ns-resolve
- Add
clojure.core/read
#317 - Add
remove-ns
#318 - Add
requiring-resolve
#316 - Add
tagged-literal?
function (@armincerf) - Support
with-redefs
#325 - New
create-ns
,new-macro-var
,copy-var
,init
andeval-string*
API functions - Add
enumeration-seq
- Add
bean
- Support GraalVM java11 #332
- Support
*print-meta*
#334 - Support
clojure.core/intern
#336 - Defprotocol and defrecord support #279, #319
- Add
double-array
andshort-array
- Add support for
*print-level*
- Elide metadata from function results (this makes calling evaluated functions from JavaScript easier) #259
- Eval metadata on vars (e.g.
(def ^{:test (fn [] \"foo\")} x)
). - Syntax check on amount of args for
if
(@jeroenvandijk) - Support namespace metadata #269
require
can now be used as a functionfind-ns
should returnnil
for non-existent namespace #299- Mark
dotimes
as termination-safe #298 - Fix metadata on syntax-quoted values #301
- Add support for
:refer :all
in namespace form #297 - Support
:rename
in:require
#303 - Add support for
use
#302 resolve
can now be used a functionloop
bindings can refer to previous ones- JS interop improvements #312
- Fix handling
atom
with metadata #314 - Fix unqualified binding of
when
andnth
infor
macro - More JS interop improvements (@jeroenvandijk)
- Fix for variadic recur #321
- Fix for associative destructuring (commit)
- Add syntax check for
ns
macro: first arg is required and should be symbol - Fix dynamic binding for functions
- Fix parser line numbers when using shebang
- Remove Java API, don't include AOT-ed sources in release
- Preserve location information in error when
NullPointerException
occurs - Support alternative field access syntax
(. Integer -SIZE)
#339 - Check syntax of
def
and report too many arguments #340 - Fix alternative field access syntax
(Integer/SIZE)
- Fix resolving var from other namespace via refer
Details about releases prior to v0.1.0 can be found here.
- Do not merge ex-data into sci error #534
- Removed
:realize-max
and:preset :termination-safe
. In the light of #348 it would be misleading to claim that sci can guarantee termination within reasonable time.
:row
and:col
metadata have been renamed to:line
and:column
to be more compatible with Clojure.
- macros provided via options (functions marked with
:sci/macro
metadata) now have two additional arguments at the start:&env
and&form
.