ok/jj
1
0
Fork 0
forked from mirrors/jj
jj/lib
Yuya Nishihara a7bff04af8 revset, templater: implement arity-based alias overloading
Still alias function shadows builtin function (of any arity) by name. This
allows to detect argument error as such, but might be a bit inconvenient if
user wants to overload heads() for example. If needed, maybe we can add some
config/revset syntax to import builtin function to alias namespace.

The functions table is keyed by name, not by (name, arity) pair. That's mainly
because std collections require keys to be Borrow, and a pair of borrowed
values is incompatible with owned pair. Another reason is it makes easy to look
up overloads by name.

Alias overloading could also be achieved by adding default parameters, but that
will complicate the implementation a bit more, and can't prevent shadowing of
0-ary immutable_heads().

Closes #2966
2024-06-14 23:11:29 +09:00
..
benches
gen-protos
proc-macros cargo: explicitly indicate paths to publish 2024-04-15 20:37:00 -07:00
src revset, templater: implement arity-based alias overloading 2024-06-14 23:11:29 +09:00
tests give descendants a range arg 2024-06-13 18:54:57 -06:00
testutils backend: add error variant for access denied, handle when diffing 2024-05-30 18:27:38 -07:00
Cargo.toml In lib, make "testing" feature depend on "git" 2024-06-11 17:14:57 -07:00
LICENSE