On Wed, Oct 24, 2018 at 2:35 PM Eric S. Raymond <e...@thyrsus.com> wrote:
> Axel Wagner <axel.wagner...@googlemail.com>: > > The key term was "occasionally". I don't know how often "iterators that > > don't need any error handling or cleanup" comes up, but I'd imagine it to > > be pretty rare. In Python, for example, this might be a bit different, > > because the iterator can just throw. And if you actually don't need error > > handling or cleanup, using a channel seems fine (and on par with any > > generic iteration construct in terms of LOC). > > > > If saving LOC is the goal (TBH I contest that all LOC are created equal > in > > this regard) there are much lower hanging fruit. > > My "low-hanging fruit" is the real problems I'm encountering > tranlating 14KLOC of algorithmically dense Python that operates on > data sets gigabytes wide (translation now 70% complete). I think > that's a pretty good road test. > So, how many such loops are there? Because if I, for example, grep through all of golang.org/x that I have on my machine right now, less than 2% of lines contain "for", so I'd say 2% already provides an extremely generous upper bound of the percentage of SLOC this would save for average Go code. It's probably a *lot* lower than that as I'd say the vast majority of loops won't benefit at all from custom iterators. But even 1% is IMO still not a very important amount of saved SLOC, especially if the saved SLOC are obvious and unlikely to hide bugs. You shouldn't assume I don't have ideas about error handling and cleanup > just bceause you haven't seen them yet. I did nothing of the sort. I just spoke from my own experience about how common that is. Anyway. Feel free to spend more time on this as you see fit. It's yours to spend, after all. They's be in a complete RFE. > -- > <a href="http://www.catb.org/~esr/">Eric S. Raymond</a> > > My work is funded by the Internet Civil Engineering Institute: > https://icei.org > Please visit their site and donate: the civilization you save might be > your own. > > > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.