On Wednesday, 29 June 2016 14:45:09 UTC+3, Sean Russell wrote: > > On Wednesday, June 29, 2016 at 2:31:59 AM UTC-4, Egon wrote: >> >> Just to be clear what I consider a *great example* for analyzing >> generics: >> >> 2. 3+ real-world packages/applications use that package >> * By real-world here I mean it wasn't written for learning or fun, but >> rather solving a concrete problem.* >> > > How about one (a single) production application with 106 types, all > sharing three common functions identical except for the type categories > they operate over? >
Hence, the either-or in packages and applications. The reason for multiple packages/applications is to ensure that it isn't an isolated problem affecting very few applications. Of course, it still is a good example... although not great. *Also it gives more weight to that particular problem compared to other generic issues.* > 1411 LOC that could not only be reduced to around 300 (interesting that my > numbers are similar to the one @Mandolyte came up with from 'interval') -- > although, I'll state again that saving LOC isn't the killer feature of this > request; it's the fact that a bug fix or other change has to be made in 25 > different places. > > >> 4. the package is implemented "in the best way" >> * e.g. linked list would be a bad example, because it's usually a bad >> solution <https://www.youtube.com/watch?v=YQs6IC-vgmo> in the first place* >> > > My example, detailed in another thread, is deserializing XML content from > a legacy SOAP application, and normalizing and simplifying the data > structures. > Could you link to it? I'm unable to find it... > The 106 types, 25 functions, and 1411 LOC is just for the SOAP & > deserializing. There's a whole other chunk of code dealing with the > conversion from type to type that I used introspection for (*that* was a > mistake!) rather than deal with several more thousand lines of duplicate > code. > > My case is extremely error prone and difficult to maintain safely. I'm > afraid to touch the code. There's enough customization on a couple types > that templating wouldn't be much help. I'd *love* suggestions of a > better way to implement than copy/paste. I can't even use introspection > > The criteria you lay out assumes a public library; bespoke, single-purpose > applications should also be able to be used as valid examples. > As said, it's just criteria for a great example -- maybe "perfect example" would be a better name :). Obviously there is room for examples that fill only some or only fill partially those conditions. -- 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.