iter_fixed icon indicating copy to clipboard operation
iter_fixed copied to clipboard

Implement more methods on stable Rust

Open GnomedDev opened this issue 1 year ago • 5 comments

Replaces most of the usage of generic_const_exprs with typenum based math.

Pros:

  • More methods usable on stable

Cons:

  • Higher complexity, as typenum math requires a ton of bounds
  • Only supports iterators up to 1024 length, as written in helpers.rs as the typenum_mapping call.

This method of using typenum to replace GCE was originally developed for https://github.com/GnomedDev/aformat, and seems to work well from the user perspective.

Sadly, I wasn't able to replace flat_map, as one limitation is how I cannot use "return type impl trait" (RTIT) as the type must be named in the where bounds and this is necessary whenever closures are involved as they are totally unnameable.

GnomedDev avatar Jul 08 '24 11:07 GnomedDev

I am not quite sure if this is worth it. As you say there is quite a complexity trade of, going from zero to two dependencies, more complex bounds etc...

usbalbin avatar Jul 23 '24 10:07 usbalbin

I'm agreed with @usbalbin, I think is an different approach which does not correspond to the philosophy of crate iter_fixed. If there is enough interest, you can create an other crate with this approach, and ask to add a link in readme. Or possibly an acceptable compromise would be to use this only on feature not enabled by default.

gwen-lg avatar Jul 23 '24 10:07 gwen-lg

What is said philosophy? Would you be okay if I locked this behind a feature like the nightly usage?

GnomedDev avatar Jul 23 '24 11:07 GnomedDev

@gwen-lg do you have any thoughts? Personally making it optional behind a feature flag feels a lot better. Still keeping it quite simple and with zero deps for those who dont want any, yet enabling nice features for those that need them.

When the day comes and the required lang features are stabelized the extra complexity can be removed as well as the feature gate.

usbalbin avatar Aug 04 '24 19:08 usbalbin

I'm ok if it's behind a feature flag disabled by default ;)

@GnomedDev : my vision of philosophy of the crate is : simple, no dependency, no unsafe.

gwen-lg avatar Aug 04 '24 19:08 gwen-lg