2 ms·
Allowed you to? You could do that in C++ quite happily, it's just not useful enough. To bother implementing, at least.
by mhh__ 7y ago
Allowed you to? You could do that in C++ quite happily, it's just not useful enough. To bother implementing, at least.
- akiselev 7y agoThey're not worth the effort in C++ because it doesn't have strictly enforced affine/dependent types. The GP is invisioning a language that does.
- ori_b 7y agoWhy do you need them to enforce that only escaped strings are passed to functions? html::append(html::string text); with an constructor html::string(std::string) that handled escaping seems like it'd work just fine.
- eska 7y agoIt's absolutely useful enough, it's just that it's awful in C++ due to language limitations as opposed to other languages such as Haskell, where it is standard.
- gpderetta 7y agoHow would be awful in c++? It seems trivial to do, basic_string is already templated and distinct instantiations are not mutually compatible by default. In fact wstring, u8string, u16string, u32string exist today in the language simply as distinct instatiantions of basic_string. You can crate your own by picking a new char type. Algorithms can be and are, generic and work on any string type.