Re: [go-nuts] [ generics ] Concrete example of comparables and generic function types

2020-08-14 Thread Beka Westberg
> Thanks for the example. My pleasure :D Thank you for taking a look! > Nice example! Presumably if you wanted to do actual Porter-Duff though, you'd want some arithmetic rather than just comparison. Thank you! And yeah if you wanted to do something like a color-dodge or other blend modes

Re: [go-nuts] [ generics ] Concrete example of comparables and generic function types

2020-08-14 Thread roger peppe
Nice example! Presumably if you wanted to do actual Porter-Duff though, you'd want some arithmetic rather than just comparison. One observation: you don't actually need the "comparable" constraint on many of the core entities there (e.g. Rect and Op) because they don't actually use any compare

Re: [go-nuts] [ generics ] Concrete example of comparables and generic function types

2020-08-14 Thread Ian Lance Taylor
On Thu, Aug 13, 2020 at 8:37 PM Beka Westberg wrote: > > Hello! I just ran into a problem that is solved really nicely with the new > generics proposal and I thought someone might find it interesting :D > > I was trying to implement a library for doing ascii art programmatically. The > main

[go-nuts] [ generics ] Concrete example of comparables and generic function types

2020-08-13 Thread Beka Westberg
Hello! I just ran into a problem that is solved really nicely with the new generics proposal and I thought someone might find it interesting :D I was trying to implement a library for doing ascii art programmatically. The main struct is basically an image.Image except it works with bytes