sux-rs
sux-rs copied to clipboard
`bit_field_vec![a; b]` is ambiguous
I naively wrote bit_field_vec~[0; n], thinking it works like a vec, but of course that is wrong and I meant something like [lgn; 0; n] as arguments. Maybe the syntax could somehow be changed to remove this ambiguity? (But I don't have a proper suggestion, and once I'm used to it the current is probably fine anyway.)
In fact, the bit_field_vec![width; a; b] constructor is still confusing, since it's vec![value; len] but here it's bit_field_vec![width; len; value].
I'm sorry, I'm a bit confused—did you get a message from the compiler complaining about ambiguity? Can you provide an example for that?
WTF I understand now. I switched the last two arguments.
That's actually a nice disaster.
I can propose to add a syntax bit_field_vec[width: value; len] or something like that. And then we deprecate (if possible) the old one.
Legally I can do bit_field_vec![width, value; len] or bit_field_vec![width => value; len].
Yes width: sound best to me. width => is also fine. I'd not do width, since that is similar to the vec! macro again in an unexpected way.
The repo has now the => version. Will release soon. Thank you noticing this, I was working in parallel on 5 releases and a few wrong things slipped in.
Thanks!