https://kotlinlang.org logo
#announcements
Title
# announcements
t

Travis Griggs

11/10/2019, 5:13 AM
I have a typealias for UInt (
typealias PlanOID = UInt
). Ideally, I’d like to bind a class/type/static function to PlanOID (e.g.
PlanOID.nowOID()
), but I think this is not possible. I’m assuming that PlanOID is just what it says, a substitution alias, not a distinct type. And since UInt doesn’t have a Companion, I can’t extend that. Is this correct? Am I missing some other trick. I get that I can just define a global free function, but I’d rather bind the behavior to the type if I could (avoids namespace clutter)
w

william

11/10/2019, 5:56 AM
currently expermental, but sounds like you would be interested in inline classes https://kotlinlang.org/docs/reference/inline-classes.html
☝️ 1
t

Travis Griggs

11/10/2019, 5:45 PM
And then I can add my own companion. Very interesting, thanks.
2 Views