Dmitry Kandalov
05/15/2020, 9:57 AM.toString()
but you can’t call it “toString” because it’s shadowed by Object#toString
?elizarov
05/16/2020, 1:38 PM.toXxxString()
where xxx
is the reason as to why it exists (debug, log, etc)Dmitry Kandalov
05/28/2020, 1:25 PM.toString()
, because why not?🙄
- use a synonym for .toString()
(what @Shawn said), e.g. .string()
or extension value .string
. For immutable objects, .asString()
is also an option.
- .toXxxString()
(what Roman said), e.g. .toDebugString()
, .toPrettyString()
- focus on a more abstract purpose rather than string, e.g. .forDisplay()
, .toDebugOutput()
, .forDeveloperEyesOnly()
, .forReport()