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.

Types: `<>` is the method of a prelude trait, Semigroup (issue #95)

`<>` was hard-wired to String. It is now `Semigroup`'s `append`, typed
like `+` with `Num`: the right side has the left side's type, and the
result too, with a `Semigroup` constraint. `fn joined(a, b) { a <> b }`
infers `where Semigroup<a>`; `s <> "!"` is still a String.

The prelude implements it for String, List (a unique list reuses its
cells), Bytes and Order (the first that is not `Eq`, to break ties when
comparing). On Strings, `<>` still lowers to a direct `tl_string_concat`
in both backends: the generated C of every benchmark is unchanged up to
the numbering of generated names.

`<>` on a type without an impl is E0401, with a note listing the types
that implement `Semigroup`.

Tests: tests/run/semigroup.lse (both backends: the four impls, generic
functions, a user impl), the inferred types and the errors in tests/ui,
and the evidence test counting the `<>` site.

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

olivier · il y a 1 mois · 56c0be6dcf09e70a46f191f9b4b2e30f436dd189

Parents b06ebda

9 fichiers modifiés, 172 ajouts, 11 suppressions