this is why programming languages need to be braindead simple with as few features as possible.
people are too fucking stupid to write simple code.
It's a goddamn cmdline parser and you manage to add a required callback and motherfucking weirdass generic shit into it.
I literally have years of professional c# dev experience and I can barely figure out how to fucking call this shit.
How hard is it to just return the goddamn object? But NO
> only idiots criticise golang's lack of generics = fact
Install ghc
>>59509745
I did, haskell has no good IDE, no debugger, no libraries, no community and is probably slower than java.
>>59509729
>this is why not everyone should be allowed to program
ftfy
There's nothing wrong with the parser, you're just retarded.
I agree with you OP. I like the general principles of programming in a side effect free way, but after maintaining too many projects over the years I've come to learn that most developers are functionally retarded and can't be trusted with even the most basic language features. So Go is really the best way to prevent this shit.
It doesn't stop devs from being retarded but it makes it much easier to come in, read their code, understand it, then fix it. Which is such a fucking boon compared to programming in C++ or Java where you have to track down the inheritance chain and figure what your base classes are and where it's mutated and etc. Go code is easy to delete code.
Although personally I still want generics.
>>59509729
use CLAP man.
>>59509790
>I like Go because it's primitive
You might as well use C.
>>59509817
I do use C.
there is an answer
>>59509790
yeah, c++ projects to me are basically dead code as soon as they are written. At least with java or c# or most other languages you can edit/compile quickly to figure stuff out but with c++, once you finally get to be able to compile it all, it takes 15 seconds (best case) every time you make any change.
Modern c++ is basically perl or worse at this point, utter madness, just reading their weird new additions I've never even heard of turns my stomach. I tried to find the link to that new c++ feature, it's called something like "left values" or "new rvalues" but point is that you just need to look at any codebase that uses boost and try to understand that.
learn c#
>>59509729
This is dead fucking simple. Pass it two lambdas. The first one you pass is run if the parsing is successful, and the second one (your error handler) is called if there's an error.
>>59509975
The documentation is fucking shit mate. You can barely see how many arguments it takes let alone what they are.
>>59509975
This is really not something the parser result object should be handling. These two lambdas have to have a very specific format in order for this to work, as you can see from the image OP posted.
What should happen here is that it raises an error if the parsing fails or just returns some form of empty object. This way the caller has full control of what is going on.
I can't think of any possible excuse for using this programming pattern, except not trusting OP to handle errors unless he is forced to.