3 ms·
Reading the tutorial is indeed very pleasant. I have to say however, that from such a new language I would ask for more correct string handling as opposed to th
by pilif 13y ago
Reading the tutorial is indeed very pleasant. I have to say however, that from such a new language I would ask for more correct string handling as opposed to the let-me-sidestep-encoding-issues-and-still-call-it-UTF8 that's going on.
Defining characters as 8 bit is not quite correct (you will get char variables holding a fraction of a character), treating strings as arrays of characters by conversion also isn't (now you have an array of partial characters) and ignoring the encoding (just assuming UTF8) is a sure cause for annoying bugs - something the rest of the language goes great lengths to avoid.
I've only read the tutorial so far. Maybe the library fixes some of the issues - we'll see. The thing is just that if you start adding metadata to your sting types (they do encode the length (in what? Characters? Partial characters? Bytes?)), then why not also at least add an encoding (to help programmers not to mix strings of different encodings)? Why do everything right and then weasel out when you get to strings?
Sorry. I'm totally obsessive what string encodings is concerned :-)
- deckiedan 13y agoSounds like you'd be a great person to join the team as chief string theorist. :-)
- qznc 13y agoI just stumbled over the way D handles this. The forum holds the discussion and reasoning, how D does it: http://forum.dlang.org/thread/uuevnvallcardcdjwikz@forum.dlang.org http://forum.dlang.org/thread/uuevnvallcardcdjwikz@forum.dla...
- Araq 13y agoStrings should be converted to UTF-8 as part of input validation. For proper input validation we have the taint mode already. Note that often a file does not include any information about the encoding, so you can only use heuristics.