[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 than

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

2023-11-18 Thread Travis Keep
I have published this module: https://pkg.go.dev/github.com/keep94/sqroot/v2 for analysing square roots and cube roots. The module works, but it is easy to write code that will run forever. For example in v2: // Print the position of the last 7 in the square root of 2. Oops, the square root o