[go-nuts] Re: Deciding between better documentation or making a module harder to misuse

2023-11-19 Thread Travis Keep
Thank you for writing and for your valuable feedback Brian. Based on your feedback, I was going to hold off on releasing my proposed v3 and go with your suggestion of writing an IsFinite() method so that my module could panic if it detects that code would run forever. But I started thinking

[go-nuts] Re: Deciding between better documentation or making a module harder to misuse

2023-11-18 Thread 'Brian Candler' via golang-nuts
Maybe you're overthinking this. One option would be for Number to have a boolean attribute saying whether it's definitely finite, exposed as an IsFinite() method on Sequence. Calling FindLast() on a sequence where IsFinite() is false would panic. It's not compile-time safe, but it's better