Any best practices with inline classes and stringT...
# announcements
t
Any best practices with inline classes and stringTemplates? I've making a pass through and ran into an interesting conversion gotcha. I have a String today, let's call it
version
I convert that into a wonderful inline class. I get all sorts of wonderful compile errors which I fix. However, this didn't pop up on the radar
val versionTag = "ver-$version"
As a String, this worked wonderfully. As an inline class, this ends up with the type name in the rendered String. I overrode
toString()
to handle this. I could have used the
val
from the inline class in the template as well. Either are valid solutions. I'm more worried about accidental usages in the future. Any thoughts as to making inline classes use in string templates a potential compile warning? Or something similar?
1
l
I’ve had similar thoughts and concerns when dealing with serialization in general.
Copy code
{
  "version": {
    "value": "1"
  }
}
is probably not what i want