dtolnay / request-for-implementation

Crates that don't exist, but should
610 stars 6 forks source link

A golang-style iota macro. #45

Closed crlf0710 closed 4 years ago

crlf0710 commented 4 years ago

Not really sure how useful is this. Just an idea at the moment. There's an outdated nightly crate with similar functionality at https://github.com/Popog/iota-rs . Example:

fn foo() -> usize {
    #![iota_scope(name = "iota", initial_value = "3")]
    let a = iota!();  // expands to literal 3
    let b = iota!();  // expands to literal 4
    a + b + iota!()    // expands to literal 5
}
dtolnay commented 4 years ago

I am going to close this because I would like to keep this repository focused on worthwhile ideas that someone is looking forward to using as soon as an implementation exists, and as you said it's unclear that an iota macro would be useful in Rust.

dtolnay commented 4 years ago

FWIW https://github.com/dtolnay/iota has my old implementation of iota that does not rely on plugins.