Category
suspicious
Shape
A (src, n) span is always turned into an owned String (span.str / take/drop) before a consumer that only needs to read those n characters (equality, quoting when plain, hashing). Prefer span-aware helpers that walk src for n steps.
Bad
def span.str(src: String, +n: U32, z: Bool) -> String:
match src z:
case s True{}:
""
case SCon{h, t} False{}:
SCon{h, span.str(t, U32.sub(n, 1), U32.is_zero(U32.sub(n, 1)))}
case _ _:
""
def quote_span(src: String, +n: U32) -> String:
key.basic(span.str(src, n, U32.is_zero(n)))
Good
def quote_span(src: String, +n: U32) -> String:
# walk n chars; if all plain, cons quotes; else fall back to escaping
span.quote(src, n)
Category
suspiciousShape
A
(src, n)span is always turned into an ownedString(span.str/ take/drop) before a consumer that only needs to read thosencharacters (equality, quoting when plain, hashing). Prefer span-aware helpers that walksrcfornsteps.Bad
Good