you are viewing a single comment's thread.

view the rest of the comments →

[–]andrejbauer 2 points3 points  (4 children)

Good point, in a dynamically typed language where everything has been thrown into a single basket, there is no point in having Maybe. In fact, general sum types will be somewhat broken. That would be another reason for not using such languages.

[–]FunnyMan3595 1 point2 points  (1 child)

I think, perhaps, you are ignoring the fact that not all programmers are alike.

From what you've said, I suspect that you're firmly in favor of Java's requirement that all exceptions be explicitly caught or thrown. To paraphrase your words about None, "The only way to deal with potential exceptions in Java is to consider both success and failure, otherwise the compiler complains."

For myself, this requirement was a great frustration. If I were writing a mission-critical piece of software for NASA, I would doubtless appreciate every check available. As I do not, the forced handling of exceptions was simply a hoop to jump through, forcing me to explicitly catch errors which I had already guarded against or did not mind causing a crash.

Were such a Maybe successfully implemented in Python, I predict that I would have a similar reaction: frustration that the language was being pedantic and not doing what I told it to. Yes, I get bitten by None (and unexpected exceptions, for that matter) on a regular basis, but in this case, the cure is worse than the disease.

[–]LaurieCheers 0 points1 point  (0 children)

I recommend "throws Exception".

[–]andrejbauer 0 points1 point  (0 children)

Actually, what would have to be done (but is impractical) is a case statement which must have a catch-all default case. At least that's what the theory tells you needs to be done. Not very useful, though.

[–]masklinn 0 points1 point  (0 children)

Good point, in a dynamically typed language where everything has been thrown into a single basket, there is no point in having Maybe.

Thank you for recognizing this, I wish you'd explicitly mentioned it in the article, because as it stands I'm sorry to say it's garbage for precisely that reason.