It's funny how it's normal to return the mutated object in Smalltalk, but I prefer to return None in Python. It's all about expectations.
Related Posts
Playing with optional type signatures in Python, I realise that the return type is the most important to me.
I'd much rather have a function with only a return type instead of a function with only parameter types. It's often quick to add too.
Counter-intuitively, if you're writing a parser for a programming language, you need it to be a total function. As soon as you build IDE tooling, you need ASTs from invalid or incomplete input.
The parser should return (Ast, List<Error>) rather than Result<Ast, Error>.
`init` feels like an unhelpful name in OO. It doesn't give you an initial value, it initialises the instance that has already been created. Developers are often surprised that init doesn't return the instance, because they have a strong association with `new Foo()`.
Perhaps `finish` would have been a less confusing name?