glossary rename + addition (#7720)

rename + addition
This commit is contained in:
Anton-4 2025-03-31 16:48:48 +02:00 committed by GitHub
parent ec16ba9837
commit 892143f113
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 20 additions and 8 deletions

View file

@ -36,6 +36,26 @@ terminal, e.g. `roc build main.roc`.
(mono, specialization)
Monomorphization, also known as type specialization, is the process of creating a distinct copy
of each instance of a generic function or value based on all specific usages in a program.
For example; a function with the type `Num a -> Num a` may only be called in the program with a
`U64` and a `I64`. Specialization will then create two functions with the types `U64 -> U64` and
`I64 -> I64`.
This trades off some compile time for a much better runtime performance, since we don't need to
look up which implementation to call at runtime (AKA dynamic dispatch).
Related Files:
- new compiler:
- [specialize_functions.zig](src/build/specialize_functions.zig)
- [specialize_functions folder](src/build/specialize_functions)
- [specialize_types.zig](src/build/specialize_types.zig)
- [specialize types folder](src/build/specialize_types)
- old compiler:
- [mono folder](crates/compiler/mono)
- [mono tests](crates/compiler/test_mono)
- [mono macro tests](crates/compiler/test_mono_macros)
## Type Checking
## Reference Count

View file

@ -1,13 +1,5 @@
//! The intermediate representation (IR) for a Roc module that has been monomorphized.
//!
//! Monomorphization, also known as type specialization, is the process of creating a distinct copy
//! of each instance of a generic function or value based on all specific usages in a program.
//! For example; a function with the type `Num a -> Num a` may only be called in the program with a
//! `U64` and a `I64`. Specialization will then create two functions with the types `U64 -> U64` and
//! `I64 -> I64`.
//! This trades off some compile time for a much better runtime performance, since we don't need to
//! look up which implementation to call at runtime (AKA dynamic dispatch).
//!
//! Doing type specialization as the first build stage helps simplify compilation of lambda sets, or
//! values captured by closures.
//!