explode programming/opinions into several subpages
This commit is contained in:
parent
62c272ff62
commit
9a86b5f98e
7 changed files with 273 additions and 256 deletions
13
content/programming/opinions/invalid.tree
Normal file
13
content/programming/opinions/invalid.tree
Normal file
|
@ -0,0 +1,13 @@
|
|||
%% title = "`None` or `Invalid` cases in enums are a bad idea"
|
||||
|
||||
% id = "01HCG7KTGGHWTT1ME9GQ5VPFPR"
|
||||
- by having them, you're forcing your users into an API that forces them to think about the
|
||||
invalid case every time they read the value.
|
||||
|
||||
% id = "01HCG7KTGGBJRX5JGQTFD59P4W"
|
||||
- you're repeating the million dollar mistake - `null`
|
||||
|
||||
% id = "01HCG7KTGGYQ8EQB97AMFJPWYK"
|
||||
- instead, use an explicit `Option<T>` or `std::optional<T>` or `T?` or ... when you need
|
||||
to represent a possibly-invalid case
|
||||
|
Loading…
Add table
Add a link
Reference in a new issue