2 ms·
It would be great if strings and especially date-time values always carried locale and timezone information with them. It would take slightly more memory but n
by kanox 6y ago
It would be great if strings and especially date-time values always carried locale and timezone information with them.
It would take slightly more memory but not significant on modern machines.
- wongarsu 6y agoPutting the locale information on the string sounds like a good idea. However I'm not sure how that should handle combined strings with components from different locales. For example `logLevel + ": " + logMessage` might produce "info: bağlantı kesildi" in Turkish. How to annotate that? Neither English nor Turkish would work correctly, each would produce the wrong result when uppercasing. You could treat it as a series of string slices with different locales `[("info", "en"), (": ", ""), ("bağlantı kesildi", "tr")]`. That would work correctly, and you could now uppercase each slice according to its appropriate locale, but it wouldn't really be low overhead anymore. Maybe still worth it. It would be an interesting approach that might even be able to be implemented pretty seamlessly as a library in some languages (C++ or rust for example)