News for hackers. Stuff that matters.
Re:Please put units in names by dtech on Monday March 21, 2022 @10:29AM (#30754525)
I recommend against that, and use proper (wrapper) types.

I don't know Kotlin, but in most languages if you alias 2 types to the same base type, for example Seconds and Minutes to Long, the compiler will happily allow you to mix all 3 of them, defeating the protection full types would bring.

Re:Please put units in names by stefs on Monday March 21, 2022 @02:56PM (#30758205)
that's correct. typealiases are the wrong solution here. the better solution would be value classes, but of course, the unit shouldn't be the type.