|
|
|
|
|
by flqn
917 days ago
|
|
Not so much "error reporting" as "there is no meaningful return value" for a position in a string -- if it wasn't found, it doesn't have a position. If you use either Optional or Result you don't need to choose a special value like -1 to be your "invalid string position" case which could be used incorrectly. I'd argue it's largely stylistic for this example, especially so outside of functional programming niches. |
|