You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
#635 closed with four fixes; items 1-3 (the doc changes) landed, item 4 did not:
Consider extending lint W017 (which already flags the 1-element bare form) to flag a bare multi-element list passed to a statically-known 1-param callee — that's the case where the user's intent and the semantics most likely diverge.
That case is still silent at v0.38.0 / 078e759.
Reproduction
define one(a) as:
return a
define two(a, b) as:
return a
print of (str of (one of [5, 6]))
print of (str of (two of [5, 6]))
[5, 6]
5
$ eigenscript --lint arity.eigs
arity.eigs:3: warning[W002]: unused parameter 'b' in function 'two'
No W017, no W022. The two call sites are syntactically identical and mean different things, and the only warning emitted is about something else.
The refactor hazard this leaves open
Beyond the write-time confusion #635 described, the carve-out makes call-site meaning depend on a callee signature that can change independently:
one of [5, 6] binds a = [5, 6].
Add a second parameter to one, and the same unchanged call site silently rebinds to a = 5, b = 6.
Nothing at parse, compile, lint, or run time reports this. Since over-arity is silently dropped and under-arity null-fills, the language has no arity error at any stage — so adding or removing a parameter can silently change the meaning of every existing bracket call site in the program, including in other files.
W022 covers over-arity for same-file callees only, and does not fire here because the 1-param case is not over-arity — it is a re-collection.
Note on the strictness policy
Worth deciding explicitly, since the same operation is treated two ways:
[a, b, c] is rhs (destructuring) is strictly length-checked and type-checked — "No truncation, no padding with null, no clamping" (LANGUAGE_CONTRACT.md:296-301).
a[i] raises on out-of-range and on non-integer; slice bounds raise rather than clamp.
f of [a, b, c] — the same list-into-names unpacking, at far higher traffic — has no check at all.
I am not arguing the carve-out should be removed; #635 established it is load-bearing (len of [1, 2], print of [1, 2]) and I confirmed that. The ask is narrower: land item 4 so the divergent case is at least visible, and consider whether over-arity on 2+-param callees should be an error rather than a same-file-only warning.
Finding
#635closed with four fixes; items 1-3 (the doc changes) landed, item 4 did not:That case is still silent at v0.38.0 /
078e759.Reproduction
No W017, no W022. The two call sites are syntactically identical and mean different things, and the only warning emitted is about something else.
The refactor hazard this leaves open
Beyond the write-time confusion #635 described, the carve-out makes call-site meaning depend on a callee signature that can change independently:
one of [5, 6]bindsa = [5, 6].one, and the same unchanged call site silently rebinds toa = 5, b = 6.Nothing at parse, compile, lint, or run time reports this. Since over-arity is silently dropped and under-arity null-fills, the language has no arity error at any stage — so adding or removing a parameter can silently change the meaning of every existing bracket call site in the program, including in other files.
W022 covers over-arity for same-file callees only, and does not fire here because the 1-param case is not over-arity — it is a re-collection.
Note on the strictness policy
Worth deciding explicitly, since the same operation is treated two ways:
[a, b, c] is rhs(destructuring) is strictly length-checked and type-checked — "No truncation, no padding with null, no clamping" (LANGUAGE_CONTRACT.md:296-301).a[i]raises on out-of-range and on non-integer; slice bounds raise rather than clamp.f of [a, b, c]— the same list-into-names unpacking, at far higher traffic — has no check at all.I am not arguing the carve-out should be removed; #635 established it is load-bearing (
len of [1, 2],print of [1, 2]) and I confirmed that. The ask is narrower: land item 4 so the divergent case is at least visible, and consider whether over-arity on 2+-param callees should be an error rather than a same-file-only warning.Suggested scope
ofis false for arity-1 callees — the implementation is right and load-bearing #635 item 4 (statically-known 1-param callee + bare 2+-element list).Related: #635, #733, #405, #153.