eprocedural 0.1.1

create proc!()s and call them, passing in implicit arguments using with!()
Documentation
  • Coverage
  • 0%
    0 out of 3 items documented0 out of 2 items with examples
  • Size
  • Source code size: 8.46 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 288.51 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 7s Average build duration of successful builds.
  • all releases: 7s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • JesseBellino

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 :/