| Crates.io | eprocedural |
| lib.rs | eprocedural |
| version | 0.1.1 |
| created_at | 2025-03-08 21:57:01.131763+00 |
| updated_at | 2025-03-08 22:02:41.418931+00 |
| description | create proc!()s and call them, passing in implicit arguments using with!() |
| homepage | |
| repository | |
| max_upload_size | |
| id | 1584838 |
| size | 8,939 |
I once prototyped a language that looked somewhat like the following:
func main [
init_counter
init_flag
while flag [
update_counter
update_flag
]
]
proc init_counter [
exp counter := 10
]
proc init_flag [
exp flag := true
]
proc update_counter with counter [
counter--
]
proc update_flag with counter, flag [
if counter == 0 [
flag = false
]
]
and decided to try implementing a similar 'thing' in rust
use eprocedural::*;
proc!( init_counter {
let counter = 10;
} defines counter: u32);
proc!( init_flag {
let flag = true;
} defines flag: bool);
proc!( update_counter with counter: u32 {
*counter -= 1;
});
proc!( update_flag with flag: bool, counter: u32 {
if *counter == 0 {
*flag = false
}
});
fn main() {
with!(init_counter);
with!(init_flag);
while flag {
with!(update_counter);
with!(update_flag);
}
}
not smart enough for auto type checking though :/