3 ms·
This is a broader look at something I've been saying for a little while: Names are not strings. Strings are a primitive type. Names are not strings in the same
by cratermoon 3y ago
This is a broader look at something I've been saying for a little while: Names are not strings.
Strings are a primitive type. Names are not strings in the same way Dates are not strings. They can be implemented, represented, and printed as strings, but they have behaviors and meaning the primitive string type does not.
The author here goes farther and notes how many things programmers represent as or with strings, but are not strings.
In code where the domain is strings, then use strings. Parsers and serialization come to mind.
It's possible to avoid using the base string type completely in a program except at the boundaries of I/O, and as an internal implementation detail, in the same way programs can use Dates, Complex, and Lat/Lon without having any need to know how they are implemented under the abstract type.