Reputation
360
Top tag
Next privilege 500 Rep.
Access review queues
Badges
3 12
Newest
 Pundit
Impact
~82k people reached

  • 0 posts edited
  • 3 helpful flags
  • 113 votes cast
Dec
10
comment What's the term for “while(true)” loop with “break” inside?
There's nothing wrong with break in the middle of a loop. If you need to carry out some operation at each start of the cycle, you will have to either duplicate the code or stuff these operations into the condition. Either variant clearly has disadvantages. goto also had valid applications, e.g. emulation of a try...finally block in C.
Nov
9
comment Is deprecating a real commitment?
Thread.stop() and Thread.suspend() are still alive and kicking though they were deprecated since Java 1.1, if I remember correctly. They are not used anymore since they are inherently unsafe, but they are still present in the API.
Sep
27
comment Why is Java considered more portable than other languages like C++?
Portability is not a myth. Perfect portability is.
Aug
20
comment Switch from C# to Java, which “gotchas” I should care?
Now you can switch on String in Java SE 7.
Aug
18
comment Should UTF-16 be considered harmful?
@niXar If some software is ignoring surrogate pairs, then it isn't using UTF-16 and therefore is non-Unicode. You wouldn't call a program which works only with ASCII as supporting UTF-8, right? I think you misunderstood my point a bit, maybe I should clarify this in the answer. I say that there's nothing wrong with the UTF-16, but there's a lot of legacy software, which was designed for UCS-2, and therefore happens to be mostly compliant with UTF-16. But mostly compliant is not compliant, and this causes problems. I also doubt that if UTF-16 didn't exist at all, it would get fixed sooner.
Aug
16
comment Should UTF-16 be considered harmful?
@tchrist I never said that Unicode and I18N are the same, though thanks for the info.
Aug
16
comment Should UTF-16 be considered harmful?
@tchrist Do you have a source for your statistics? Though if good programmers a scarce, I think this is good, because we become more valuable. :) As for the Java APIs, char-based parts may eventually get deprecated, but this is not a guarantee that they won't be used. And they definitely won't be removed for compability reasons.
Aug
13
comment Should UTF-16 be considered harmful?
@tchrist One must be a very ignorant developer to not know that UTF-16 is not fixed length. If you start with Wikipedia, you will read the following at the very top: "It produces a variable-length result of either one or two 16-bit code units per code point". Unicode FAQ says the same: unicode.org/faq//utf_bom.html#utf16-1. I don't know, how UTF-16 can deceive anybody if it is written everywhere that it is variable length. As for the method, it was never designed for UTF-16 and shouldn't be considered Unicode, as simple as that.
Aug
12
comment Should UTF-16 be considered harmful?
Consider it non-Unicode, that would clear the confusion. Historically this method is simply not meant to work reliably in conditions where I18N is required, it is not even locale-aware. Java has different facilities to do that. And I have to remind you that we're off the topic, still talking about subtleties of APIs, not about the UTF-16 itself.
Aug
12
comment Should UTF-16 be considered harmful?
Yes, equalsIgnoreCase() compares chars, not codepoints, and it is stated in the docs. I certainly agree that if this method compared strings usign code points, it would be much simpler. But this isn't a problem of UTF-16 itself, it is a problem of a platform which was originally designed for UCS-2 - exactly what I'm talking about.
Aug
12
comment Should UTF-16 be considered harmful?
@tchrist This is all too general. First of all, define what is a "BMP screwup" and where you look for them. Also, I've already said that there's a huge difference between something that was designed for UTF-16 and something that was designed for UCS-2 and then switched to UTF-16. And if we put aside API and language deficiencies, I don't reallly see what's so terribly difficult in handling surrogate pairs, especially in comparison with UTF-8.
Aug
11
comment Should UTF-16 be considered harmful?
@tchrist Actually I think that most problems appear from the dated software which was designed for UCS-2. If you implement the standard today, you will be almost certainly aware that UTF-16 has a concept of surrogate pairs, since it is written about almost everywhere, starting with Wikipedia. And if you are an ignorant developer, you may not implement support for characters outside BMP in UTF-8 as well. Or even treat every text as if each byte represented only one character.
Aug
1
comment If a variable has getter and setter, should it be public?
+1 for "you should be asking an object to do an operation for you"
Jul
28
comment Are languages just syntax or do they include the framework too?
No, no, it doesn't dictate implementation details and there are not many classes which are explicitly mentioned in the specs compared to the core library in its entirety. But my point is that the language and the library are tightly connected. A vendor actually can't not ship at least the most necessary parts of the library because the spec makes their presence mandatory. And therefore these parts become sort of a part of the language.
Jul
28
comment Are languages just syntax or do they include the framework too?
I mean the latter, of course. Say, "The direct superclass of an enum type named E is Enum<E>." Enum is a class from the core library. Or: "The unchecked exceptions classes are the class RuntimeException and its subclasses, and the class Error and its subclasses. All other exception classes are checked exception classes." And this directly influences how particular exceptions must be handled in the terms of language. And such mentions happen throughout the whole specification.
Jul
28
comment Are languages just syntax or do they include the framework too?
What if the language specification frequently references the framework? This actually happens in Java Language Specification, for example.
Feb
13
comment Should UTF-16 be considered harmful?
Why would they be angry?
Jan
23
comment Should UTF-16 be considered harmful?
Exactly, all the encodings cover all the code points; and as for the lack of available codes, I don't see how this can be possible in forseeable future. Most supplementary planes are still unused, and even the used ones aren't full yet. So given the total sizes of the known writing systems left, it is very possible that most planes will never be used, unless they start to use code points for something different than writing systems. By the way, UTF-8 can theoretically include 6-byte sequences, so it can represent even more code points than UTF-32, but what's the point?
Jan
1
comment Should UTF-16 be considered harmful?
Well, I don't think that mere existence of crappy implementations indicates harmfulness of the standard at all. :p This is just an update on the current situation: how problematic characters beyond BMP in Windows (and Opera) are now.
Jan
1
comment Should UTF-16 be considered harmful?
Once. I specially checked for this issue, and in Windows 7 the problem with the characters beyond BMP seems to be gone. Maybe this problem had been solved even in Vista.