Hacker News new | ask | show | jobs
by cratermoon 1004 days ago
Why use strings and pass them around in the first place? Why not limit the use of String types to system boundaries where data must be serialized into or from character-oriented streams?
1 comments

The typical strategy for doing that in a context like this is string interning. That's literally what most of the types described in the post are doing behind the scenes, in one form or another. The post is literally about doing your suggestion -- just using a library to do so, and leveraging the type system to reduce some of the boilerplate.