|
|
|
|
|
by WirelessGigabit
1332 days ago
|
|
If TeamId is a non-nullable string then the construction of that object should fail when TeamId is null, not at the consumption site. This is exactly the issue what Rust is solving. A struct construction completes or fails. There is no weird in between state. |
|
The issue they had is:
(a) TeamId is legitimately nullable at creation, there are valid SlackEvents without a TeamId
(b) They wanted to assert "TeamId won't be null" from a certain point in the code path
(c) They didn't want to create a different data structure (TeamSlackEvent or something) to hold the definitely-has-a-TeamId events.
I strongly suspect (c) was a mistake and they were just too lazy to define a new (sub)-class or record.