explode programming/opinions into several subpages

This commit is contained in:
りき萌 2025-01-15 20:22:31 +01:00
parent 62c272ff62
commit 9a86b5f98e
7 changed files with 273 additions and 256 deletions

View 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