Enforce def for Li procedures¶
Summary¶
User-facing Li functions must be declared with def; bare proc is rejected except after extern for C ABI.
Agent continuation¶
- Read
docs/language/control-flow-and-functions.mdanddocs/language/overview.mdfor the canonical declaration shape. - Run
./li-tests/run_all.sh encapsulationandlic buildon any touched.liafter edits. - Next: migrate external snippets or course material that still use
proc; keepextern procand callableproc(...)types in annotations per design spec. - Blocked: none — parser error is
use 'def' for Li procedures; 'proc' is only allowed after 'extern'.
Changed¶
compiler/parser/parser.cpp— reject top-level /async/ decoratedproc; requiredef.scripts/migrate-proc-to-def.py— one-shot source migrator (181.lifiles).scripts/check-li-def-syntax.sh— CI/policy grep gate (rg); wired inscripts/ci.shand package mirrorci.yml.scripts/sync-package-mirror-def-syntax-pr.sh— syncpackages/<name>/to org mirrors.li-tests/encapsulation/proc_syntax_rejected.li+ manifest row (compile_fail).- Handbook and examples under
docs/,examples/,packages/,benchmarks/,std/,li-tests/. - Stripped agent/history header comments from tests, package stubs,
std/facades, andscripts/templates/package/library/src/lib.li.template(CWE test labels unchanged). - All
packages/*/.github/workflows/ci.yml— run def-syntax check beforelic build.
Downstream (package mirrors)¶
Open PRs on official mirrors (sync from packages/<name>/):
| Repo | PR |
|---|---|
li-std-core | https://github.com/li-langverse/li-std-core/pull/4 |
li-std-math | https://github.com/li-langverse/li-std-math/pull/5 |
li-httpd | https://github.com/li-langverse/li-httpd/pull/4 |
li-net | https://github.com/li-langverse/li-net/pull/4 |
li-demo | https://github.com/li-langverse/li-demo/pull/5 |
Physics/UI packages (li-std-physics-*, li-std-ui, …) live in the monorepo only until published as separate repos.
Not changed¶
extern procfor FFI (still required afterextern).- Callable type spelling
proc(a: T) -> Uin type positions (design spec). - Future
gpu prockeyword (spec only; not parsed as userdeftoday). decorator deffor execution-decorator macros.
Breaking¶
| Before | After |
|---|---|
proc foo() -> int | Compile error — use def foo() -> int |
async proc worker() | async def worker() |
extern def foo() | Compile error — use extern proc foo() |
Security¶
N/A — syntax-only; no trusted surface change.
Performance¶
N/A — no codegen change.
Downstream¶
- Regenerate or hand-fix any out-of-tree
.lithat still usesprocfor definitions. - Benchmarks ingest (
benchmarksrepo) picks up Li sources fromlicon sync; no separate action if trackinglicmain.