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.

Syntax: `_` placeholders in pipes, and function captures (issue #88)

As in Gleam, `_` among a call's arguments says where a value goes:

- `x |> f(a, _)` is `f(a, x)`, labelled too (`x |> f(label: _)`);
  `x |> f(a)` still places `x` first.
- `f(a, _)` alone is a capture, `fn(v) { f(a, v) }`: the callee and the
  other arguments are evaluated at each call.

A pipe's left side is evaluated first, as written: when the callee or an
argument before its place could have an effect, it is bound to a local
beforehand (this also fixes `x |> make()(a)`, which ran `make()` first).

Both are desugared in HIR, so types, effects, Perceus and both backends
see ordinary calls and lambdas. The locals this introduces are marked
`synthetic` and hidden from hovers, navigation, completion and semantic
tokens.

Errors are E0116: several `_` in one call, `_` with a `..` spread, `_`
filled by `use`, and `_` anywhere but directly as a call's argument.

Tests: lowering unit tests, a parser corpus file, tests/run/pipes.lse on
both backends (evaluation order, a tail call through a pipe), and
tests/ui/placeholders.lse. Tree-sitter: a `placeholder` node.

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

olivier · il y a 1 mois · b75e3eb8a04a865c1180c0b24aea0ac5723fcef6

Parents cc7db05

22 fichiers modifiés, 8635 ajouts, 7852 suppressions

Mcrates/louise_db/src/ide/complete.rs+2−1
Mcrates/louise_db/src/ide/hover.rs+4−2
Mcrates/louise_db/src/ide/tokens.rs+2−2
Mcrates/louise_hir/src/lower/mod.rs+217−39
Mcrates/louise_hir/tests/lower.rs+103−1
Mcrates/louise_syntax/src/grammar/expr.rs+8−1
Mcrates/louise_syntax/src/syntax_kind.rs+2−0
Acrates/louise_syntax/tests/data/ok/placeholders.lse+7−0
Acrates/louise_syntax/tests/snapshots/parser__ok_corpus_parses_cleanly@placeholders.lse.snap+126−0
Meditors/tree-sitter-louise/grammar.js+7−1
Meditors/tree-sitter-louise/queries/helix/highlights.scm+1−0
Meditors/tree-sitter-louise/queries/highlights.scm+1−0
Meditors/tree-sitter-louise/src/grammar.json+19−2
Meditors/tree-sitter-louise/src/node-types.json+18−4
Meditors/tree-sitter-louise/src/parser.c+7933−7795
Meditors/tree-sitter-louise/test/corpus/expressions.txt+39−0