Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Allowed you to? You could do that in C++ quite happily, it's just not useful enough. To bother implementing, at least.


It'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.


How 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.


They'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.


Why 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.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: