tobogganSe connecter

louise

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

Effects: clock and random, handled by the runtime; std/time, std/random, std/prng; ADR 0036 (issue #142)

The time and random numbers are now read through two effects, so code
says it uses them and a test can handle them:
- std/time: `effect clock { now_unix_ns, monotonic_ns }`, Timestamp,
  Duration, the UTC calendar, RFC 3339 format and parse,
  `with_fixed_clock`.
- std/random: `effect random { bytes }`, and in Louise `int` (rejection
  sampling), `range`, `float`, `shuffle`, `choice`, `token`, and
  `with_seed` over std/prng (SplitMix64 over U64; not for secrets).

The runtime handles `proc`, `clock` and `random` around `main`, tests
and every actor. Actor rows become `<proc, clock, random, io, ffi>`.
- Lowering records each function's root capability kinds
  (`Program::root_caps`) and the actor body layout, derived from
  `std/process.spawn`'s parameter type (`Program::actor_caps`).
- `runnable` compares built-in effects by definition, not by name.
- Runtime ABI 6: `tl_root_cap(ctx, kind, ops)`, `tl_main_program(entry,
  caps, n)`; clock and random capabilities are immortal (rc 0) and
  built once; only their clauses read the OS. `tl_random_int` and
  `tl_random_token` are removed.
- The interpreter answers clock and random at its root, without a
  scheduling point.

argon2's `hash_password` performs `random`; the demo's tests seed it.
The E0505 note names the right std module for proc, clock and random.

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

olivier · il y a 1 mois · ef4aa2ec32afd4b12d4af5e27295bfd6f24622ba

Parents 0dbeba6

46 fichiers modifiés, 1594 ajouts, 203 suppressions

Acrates/louise/tests/fixtures/errors/own_clock.lse+10−0
Mcrates/louise_codegen_c/src/emit/mod.rs+37−7
Mcrates/louise_codegen_c/src/lib.rs+24−13
Mcrates/louise_core/src/externs.rs+0−2
Mcrates/louise_core/src/lower/mod.rs+82−0
Mcrates/louise_core/tests/lowering.rs+34−0
Mcrates/louise_interp/src/externs.rs+1−17
Mcrates/louise_interp/src/sched.rs+8−3
Mcrates/louise_types/src/env/mod.rs+35−4
Adocs/adr/0036-clock-and-random-effects.md+63−0
Mexamples/http_demo/test/app_test.lse+5−2
Mpackages/argon2/test/argon2_test.lse+2−1
Mruntime/louise_rt/include/louise_rt.h+17−10
Mruntime/louise_rt/src/process.rs+35−12
Mruntime/louise_rt_prims/src/lib.rs+45−34