Files
RustAst/examples/optimizer_collision_repro.myc
T
Michael Schimmel c64902726b Refactor address types to use newtype wrappers
This commit introduces newtype wrappers for `LocalSlot`, `UpvalueIdx`,
and `GlobalIdx` to improve type safety and clarity. These wrappers
replace direct use of `u32` for indices, making the code more robust and
easier to understand.

The changes include:
- Defining `LocalSlot`, `UpvalueIdx`, and `GlobalIdx` structs.
- Implementing `Display` for these new types to provide user-friendly
  output.
- Updating the `Address` enum to use these new types.
- Modifying various compiler components (analyzer, binder, optimizer,
  type checker, environment, VM) to use the new types.
- Adjusting tests to accommodate the changes.
2026-02-25 18:24:26 +01:00

13 lines
222 B
Plaintext

;; Benchmark: 129ns
;; Benchmark-Repeat: 15510
(do
(macro wrap [f] `(fn [x] (~f x)))
(def add1 (fn [x] (+ x 1)))
(def add2 (fn [x] (+ x 2)))
(def w1 (wrap add1))
(def w2 (wrap add2))
(w1 (w2 10)))