What's hard to do? (limit 100 words)
In DSLX, the fail! macro is often used both for unreachable code and for code that isn’t implemented yet. Rust has separate macros for these: unreachable!() and unimplemented!(). These make the code easier to read and understand, and help you quickly find unfinished or broken parts. It would be helpful to have the same kind of macros in DSLX to make intent clearer and make the codebase easier to work with.
Current best alternative workaround (limit 100 words)
Use fail! macro with a correct label, or assert! with false as a predicate:
enum MyEnum: u2 {
A = 0,
B = 1,
C = 2,
}
#[quickcheck(exhaustive)]
fn qc(x: MyEnum) -> bool {
match x {
MyEnum::A | MyEnum::B | MyEnum::C => true,
_ => fail!("impossible_value", false),
}
}
)";
Your view of the "best case XLS enhancement" (limit 100 words)
Adding unreachable!() and unimplemented!() macros would make DSLX code easier to read and understand. It would also help people find and track incomplete code or logic errors. fail! could then be used only for real failure conditions.
What's hard to do? (limit 100 words)
In DSLX, the
fail!macro is often used both for unreachable code and for code that isn’t implemented yet. Rust has separate macros for these:unreachable!()andunimplemented!(). These make the code easier to read and understand, and help you quickly find unfinished or broken parts. It would be helpful to have the same kind of macros in DSLX to make intent clearer and make the codebase easier to work with.Current best alternative workaround (limit 100 words)
Use
fail!macro with a correct label, orassert!withfalseas a predicate:Your view of the "best case XLS enhancement" (limit 100 words)
Adding
unreachable!()andunimplemented!()macros would make DSLX code easier to read and understand. It would also help people find and track incomplete code or logic errors.fail!could then be used only for real failure conditions.