4 ms·
I am not entirely convinced that unicode has been retrofitted elegantly into Delphi. A lot of legacy functions using string (read: what is now AnsiString) have
by Svip 13y ago
I am not entirely convinced that unicode has been retrofitted elegantly into Delphi. A lot of legacy functions using string (read: what is now AnsiString) have been modified to still support string; so AnsiPos() for instance takes string, unless you use AnsiStrings unit. And that's just confusing.
In a code base like the one I work with all the way back to Delphi 3, there are other legacy issues as well; such as the late arrival of TBytes, which meant that in olden days you had to handle binary data in strings. Now suddenly they are unicode strings are far less reliable for unicode.
Of course, the compiler doesn't warn you about that, because it isn't clear what you were doing back then. Still, took us a year to get our code from Delphi 2007 to XE3.
I am not saying Delphi is the worst thing ever, but I wouldn't say its legacy support is as elegant as you put it. There are issues, that are not noted by the compiler (unlike the deprecated flag for old functions and the like).
Also the fact that it used to have both {$ENDIF} and {$IFEND} is amusing, but at least now they only want one; but you cannot change it because then it would break code that needs to be compiled in an older version of Delphi.
Edit: But I will say this: I do believe unicode was introduced into Delphi as elegantly as possible. It's very hard to do truly elegantly, I'd imagine.
- Joeri 13y agoWell, when I say that they retrofitted unicode elegantly, I'm ofcourse comparing it to how unicode was retrofitted into PHP. Elegant is in the eye of the beholder I suppose. The same goes for maintainability. Upgrading the codebase was a sizeable effort for sure, but in my view it was less than it would have been had it been developed on another platform.
- mappu 13y agoUnicode was retrofitted into PHP and then the entire effort was abandoned, so yes, i think anything would be more elegant. PHP currently supports unicode in the same way as lua or C - every string is a binary string. If you want correct UTF-8 behaviour in string functions then instead of using libc or string_ functions, you must pass the character set as an additional parameter to specialised mb_ string functions instead.
- sebastianavina 13y agotalk about python and unicode management...
- memsom 13y agoBinary data in strings? "array of byte" surely?