Missing unprefixed sugar for pow (i.pow has no bare alias) #489
Labels
No labels
bug
dependencies
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
refactor
rust
technical-debt
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
navicore/patch-seq#489
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
i.powis missing the unprefixed sugar alias that every other integer arithmetic / comparison op has.+,-,*,/,<,>,=,<>, etc. all resolve to theiri.*counterparts when written bare, butpowdoes not.Reproduction
Run
seqc linton the third — error:The first two compile fine (modulo unrelated
i./Bool-flag bookkeeping for the/case).Expected
powshould resolve toi.powwith the same( Int Int -- Int Bool )signature — matching how/resolves toi./and keeps the Bool flag fromi.modulo/i.divide.Why this matters
Seq's design choice (per
docs/language-guide.md) is thati.prefixes are required on the canonical word names but bare arithmetic/comparison ops resolve via implicit sugar. The sugar is undocumented in the language guide but it's clearly present (the examples above prove it). Wheni.powwas added, the sugar table wasn't updated alongside, leavingpowas an outlier among the arithmetic ops.Knock-on effect: seqlings chapter 27 (the
std:imathchapter) has an exercise that asks the student to type2 10 pow— which mirrors the docs inSTDLIB_REFERENCE.mdand the surrounding sugar conventions, but doesn't compile.Suggested fix
Wherever the bare-name sugar table for integer ops lives, add
pow → i.pow.If the language-guide doc-bug (sugar table not documented) is in scope, that's worth fixing in the same PR — currently a reader has to discover the sugar empirically.
What the design doc says
docs/design/done/INT_POW_BUILTIN.md:22-23 is explicit:
▎ No alias, no shim. The stdlib pow in imath.seq is deleted in the same commit; callers move to i.pow.
That was a deliberate v7.0 decision, not a forgotten-update bug. And docs/language-guide.md:1018-1021 documents
the convention: i. prefixes are required on named forms; only the symbolic forms get sugar.
Verdict
lt, etc. would introduce an inconsistency rather than fix one. Adding all of them is a much larger design change
(and contradicts the explicit "named ops require i." guidance in the language guide).
That's a seqlings fix, not a compiler fix.
If you wanted to do anything here, the smallest defensible move would be a better error message for bare
pow/add/eq/etc. — something like Unknown word: 'pow' — did you mean 'i.pow'? — rather than introducing new
sugar.