José Pablo Wenzel
12/16/2022, 2:34 PMInt
that validates wether the number is a valid national identity number, although I've been using typealias Nin = Int
. On the other side my internal engineering brain is telling me that I'm adding unexpected behaviour to types I don't own . What is the general community consensus around it?Jakub Gwóźdź
12/16/2022, 2:43 PMRob Elliot
12/16/2022, 2:54 PMInt
, only to Int
when in the context of a national identity number. You have to import the extension function explicitly for it to be visible.Rob Elliot
12/16/2022, 2:57 PMi.validate().toNi()
is much nicer to read and reason about than toNi(validate(i))
2. They are brilliant for null handling. Instead of val ni = if (i != null) toNi(i) else null
or val ni = i?.let { toNi(i) }
it's much nicer to write val ni = i?.toNi()
3. They allow subject verb object word ordering for those for whom it is naturalRobert Williams
12/16/2022, 3:04 PMRobert Williams
12/16/2022, 3:04 PMRobert Williams
12/16/2022, 3:05 PMKlitos Kyriacou
12/16/2022, 5:41 PMJosé Pablo Wenzel
12/19/2022, 8:10 AMtypealias
may help a little bit with it)... in regards of @Klitos Kyriacou message, the example was just an illustrative example just to make my question is not a real situation