Skip to content

One-liners can't use a module: with -n 'use std.time …' fails to parse #2015

Closed

Description

@ehartford

Found by the #1899 store work. ... | with -n 'use std.time.now_ns' ... (and -p/-e likewise) fails to parse, so a one-liner can't import a std module beyond the prelude. CLAUDE.md teaches with -e 'use std.json ⏎ print(...)' as the jq replacement, so this is a documented capability; a failed one-liner is a product bug (memory: one-liner pain is priority). Fix: the one-liner wrapper (§18.5b statements entry, #1816's set_statements_entry) must hoist top-level use lines out of the per-line loop body for -n/-p, and accept them for -e. Failing-first cli-selfhost-one-liner cases for -e/-n/-p with a use.

Activity

  1. added
    bug
    on Oct 3, 2026
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

    bug

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions