2 ms·
User IDs probably shouldn't be passed around as ints
- fiedzia 2y agoints as user ids are fine, a language with tons of footguns isn't
- karmakaze 2y agoThe two common ways of dealing with this: 1. use a distinct type if your language supports it--ideally it could be zero-cost abstraction (such as in Go), 2. any int or boolean argument should be a keyword one so errors are clearly visible: ban_account(user_id: i);
- flysand7 2y agoMy thoughts on this: only the database cares that an ID is an integer. Outside systems typically don't mind IDs as strings, so why not use strings? It's not like we're doing math on IDs