-
Notifications
You must be signed in to change notification settings - Fork 33
Open
Description
Rant: Not sure if idiomatic or not, but I wonder if we should start considering nil in all these util functions around the project.
For example, this is completely valid code:
var foo *SlackPost = nil;
if (foo.IsPlainMessage()) {
...
But it will create a panic in execution.
If we were to add a line here like:
if p == nil {
return false
}
There will be no panic in execution.
There are people that would claim that a panic in execution is fine, since it means we are using the function wrong, and it is better to "fail soon and fail hard".
Others may claim that a panic in execution cannot be accepted.
But then in many places (not the case here from what I saw) we have checks like foo != nil && foo.IsPlainMessage(). So I wonder if it is a pattern we should start using.
Originally posted by @larkox in #75 (comment)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels