Comment by pillmillipedes
9 hours 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}.
9 hours 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}.
To expand and give some notion of good taste:
It's more about writing
over
I 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