Replacement for Zip/Lockstep

monarch_dodra monarchdodra at gmail.com
Mon Mar 17 02:00:36 PDT 2014


On Monday, 17 March 2014 at 02:19:58 UTC, bearophile wrote:
> One problem is that "StoppingPolicy.requireSameLength" is very 
> long, so putting it in UFCS chains kills too much horizontal 
> space.

Thanks for the bug reports. I'll have to read them all in depth 
to really appreciate them in depth.

I think you've convinced me to keep "shortest" as default, as 
consistency is king. It *would* help to have short aliases to 
promote simpler usage of each mode. Something like "zipShortest, 
zipLongest, zipSameLength". For example.

I like 8715, I'll see if I can make it happen. I'm just worried 
about having functions with 2 different default parameters. That 
said, proper template magic could allow you to write whatever you 
want and still work ^^.

Thinking about it harder, I'm wondering if it isn't possible to 
actually have a Zip!condition coexist with the run-time version. 
In which case, all I'd have to do is add the new version. I'll 
see what I can do.

If not, the other idea is to alias `lockstep(condition)` to 
return a `Zip`, and introduce a new and improved `lockstep`. This 
works because (AFAIK), there is no publicly available `Lockstep`.

But I'd rather keep the name `Zip` if at all possible.

Time to start working!


More information about the Digitalmars-d mailing list