5 ms·
if a user with/without phone number are equally valid states to be then types won't help you much. I think it's more about writing class User{phone: ?PhoneNu
by pillmillipedes 3mo ago
if a user with/without phone number are equally valid states to be then types won't help you much. I think it's more about writing
class User{phone: ?PhoneNumber}
over
class User{phone: ?string}.
- throwwwll 3mo agoTo expand and give some notion of good taste: It's more about writing struct User {phone: MaybePhoneNumber} // give or take, it's a monoid over struct User {phone: Option<String>}
- pillmillipedes 3mo agoI don't mind discussing syntax when appropriate, but this feels like arguing over which trivial brainfuck substitution[1] is the best. > monoid nullables with `??` and `?.` are also give-or-take monoids. is it common though to `or` two MaybePhoneNumbers together or to apply a PhoneNumber->MaybePhoneNumber function to it? if not then why mention it? let's see something meaningfully different like a database schema. [1] https://esolangs.org/wiki/Trivial_brainfuck_substitution https://esolangs.org/wiki/Trivial_brainfuck_substitution