3 ms·
If foo contains an instance TrimmedString, why can't it just return itself after the first + operation? If you send a TrimmedString to a String, then all bets
by stcredzero 18y ago
If foo contains an instance TrimmedString, why can't it just return itself after the first + operation?
If you send a TrimmedString to a String, then all bets are off. This would make the use case: if you start with a TrimmedString, you always have a TrimmedString. (Barring operations that are deliberate conversions.)
- shrughes 18y agoBecause if foo contains "f" and bar contains "b", then your scheme would have (foo + " " + bar) contain "fb" and not "f b"
- stcredzero 18y agoThen the fool should use a regular String! RTFM!