Skip to content

comptime: string ordering rejects deterministic comparisons and blocks zlib migration #1114

Closed

Description

@ehartford

Specification §17 defines comptime as execution of regular With code; §17.1 permits deterministic computation over values. String ordering works at runtime but the comptime evaluator rejects all four ordering operators.

Minimal reproduction:

const ordered = "alpha" < "beta"
fn main: assert(ordered)

with check repro.w reports comparison requires comptime scalar values; expected: the constant evaluates to true. This blocks #1103's zlib migration after all source files translate, when zlib_sorted_strings builds the deterministic bundle import list.

LLDB on 7faf0ce's stage2: ComptimeEvaluator.eval_binary_compare receives op=7 (OP_LT), lhs.kind=rhs.kind=4 (CV_STR). Its string branch handles only EQ/NEQ; the branch at 0x1000c9a74 reaches the rejection block at 0x1000c9b58, calling fail at 0x1000c9b7c. Source: src/ComptimeEval.w:6764–6774. The fix adds the four ordinary string-ordering operations to the evaluator, matching native string semantics. No workaround or generated-code edit is used.

Regression coverage and debugger evidence are being added in #1103 (docs/comptime-string-order-debug.md).

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions