[Feature] compile time macros
- Vorherrschende Sprache
- Rust
- Sterne
- 5.2k
- Forks
- 145
- Ø Merge
- 5 T. 3 Std.
- Gemergte PRs (30 T.)
- 7
Beschreibung
i think we should allow for some macro-like syntax that is evaluated at compile time to save runtime.
not sure how to implement this, though. i think that they should emit amber code that is inserted into the places where they are called. like this:
```ab
macro compile_env(var: Text): Text {
return text_value(trust $\${var}$);
}
echo compile_env("LANG");
```
which will evaluate to something like this, assuming that `LANG` is `en` on compile time:
```ab
echo "en"
```
`text_value()` returned a text literal with the value of `trust $\${var}$`, which was evaluated on compile time
---
ref #436 , but this issue is for discussing the implementation of macros themselves, not the `compile_env!()` macro specifically
Beitragsleitfaden
Für dieses Repository ist kein Beitragsleitfaden indexiert
Bewertung
Dieses Issue wurde noch nicht bewertet.