3 ms·
> An arbitrary object should have absolutely no business knowing how to render itself, Well, `toStrig` and its inverse make sense mostly for value types and th
by zvrba 7y ago
> An arbitrary object should have absolutely no business knowing how to render itself,
Well, `toStrig` and its inverse make sense mostly for value types and these usually have ONE canonical representation. SQL has been based on converting values to/from strings since... always. E.g., when I want to insert a GUID into a table in SQLServer, I send it in as a... string. JDBC driver returns it as a string as well.
Problems with string conversions arise when a value type doesn't have a single canonical representation, e.g., dates and times.