Script mode with shebang support #292

Closed
opened 2026-01-21 22:29:36 +00:00 by navicore · 1 comment
navicore commented 2026-01-21 22:29:36 +00:00 (Migrated from github.com)

Script mode with shebang support

Description:

Add script mode to seqc so .seq files can be run directly with shebangs:

#!/usr/bin/env seqc
: main ( -- Int ) "Hello from script!" io.write-line 0 ;

chmod +x hello.seq
./hello.seq

Proposed behavior:

  1. Detect script mode when first argument is a .seq file
  2. Compile with -O0 (fast compile, no optimization)
  3. Cache compiled binary in $XDG_CACHE_HOME/seq/ (keyed by source hash + include hashes)
  4. Run cached binary if cache hit, otherwise compile → cache → run
  5. Pass remaining argv to the script

Cache details:

  • Key: hash of source content + hashes of all includes
  • Location: $XDG_CACHE_HOME/seq/ or ~/.cache/seq/ fallback
  • No cleanup policy initially (user can rm -rf the cache)

Non-goals (for now):

  • Optimized builds (use seqc build for that)
  • Incremental compilation
  • Automatic cache eviction
Script mode with shebang support Description: Add script mode to seqc so .seq files can be run directly with shebangs: #!/usr/bin/env seqc : main ( -- Int ) "Hello from script!" io.write-line 0 ; chmod +x hello.seq ./hello.seq Proposed behavior: 1. Detect script mode when first argument is a .seq file 2. Compile with -O0 (fast compile, no optimization) 3. Cache compiled binary in $XDG_CACHE_HOME/seq/ (keyed by source hash + include hashes) 4. Run cached binary if cache hit, otherwise compile → cache → run 5. Pass remaining argv to the script Cache details: - Key: hash of source content + hashes of all includes - Location: $XDG_CACHE_HOME/seq/ or ~/.cache/seq/ fallback - No cleanup policy initially (user can rm -rf the cache) Non-goals (for now): - Optimized builds (use seqc build for that) - Incremental compilation - Automatic cache eviction
navicore commented 2026-01-21 23:02:20 +00:00 (Migrated from github.com)
https://github.com/navicore/patch-seq/pull/293
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
navicore/patch-seq#292
No description provided.