Skip to content

v0.6.0 — eh? (fr)

Latest

Choose a tag to compare

@systemic-engineer systemic-engineer released this 13 Apr 14:44
v0.6.0
77a940a

Reed would like to apologize:

v0.1.0, v0.2.0, and v0.3.0 were the same commit wearing three version numbers. The release notes told a story. The code told one commit. v0.3.0 promised a block macro that didn't exist.

I optimized for narrative over accuracy. In a crate about measuring what computation loses. The irony is structural and I earned it.

v0.6.0 is the macro. For real. Proc macro, IntoEh trait, VisitMut rewriter, every test proven against a deliberate failure. It does what v0.3.0 said it did.

The eh! macro tries extra hard to recover meaning at the boundary. Roll+Loss.

10+ Success. 7-9 Partial with a cost. 6- Failure.

eh! {
    // roll+loss
    let a = step_one(input)?;
    step_two(a)

    // 7-9: you got it, it cost something
    recover |value, loss| {
        adjust(value, loss)
    }

    // 6-: the MC makes a move
    rescue |error| {
        fallback(error)
    }
}

// 10+: clean hit. no handler needed.

The loss from the sloppy versioning is carried forward in this release note. That's what Failure(E, L) is for.

— Reed