tobogganSe connecter

louise

The Louise language: compiler, runtime, std, tooling

Clone avec HTTPS, un jeton personnel en mot de passe, ou avec SSH, une clé ajoutée dans vos paramètres.

Core: a partial application captures what it is given (#321)

A partial application's closure found its captured variables by raw
`VarId`, searched across frames that each number their own from zero.
Temporaries (a field, a call's result, a dictionary) were not in any
frame's `vars`, so they were not captured: the closure read another
function's slot (`()` at run time, or an index panic in the simplifier
or the interpreter). The same search let one capability alias another,
and matched unrelated `let`s of outer frames.

- `closure_over` builds the three closures (`eta`, `partial_fn`,
  `partial_perform`) from atoms of the current frame: each distinct
  variable becomes one parameter, a literal stays as is.
  `lookup_var`, `captured_atom` and `Key::Capture` go.
- `call_value` gives a partial application of a function value one hole
  per parameter not given; it had none (`f "#"` printed `#0` natively).
- Debug builds check lowered Core: every variable a function uses is a
  parameter or bound by one of its `let`s, below `n_vars`
  (`lower/closed.rs`). It fails on the old lowering of this test.
- tests/run/partial_application.lse: a field, a call, a later call, a
  partial of a partial, inside a lambda, a dictionary, two capabilities
  in another order, a function-valued parameter and field, an operation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

olivier · il y a 1 mois · 7e706f217c07df5bd48011ebfd78b196908a8b30

Parents 9e48c89

3 fichiers modifiés, 277 ajouts, 236 suppressions

Acrates/louise_core/src/lower/closed.rs+31−0
Mcrates/louise_core/src/lower/mod.rs+146−236
Atests/run/partial_application.lse+100−0