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
Jan
4
comment Why are there so many string classes in the face of std::string?
@CatPlusPlus Can't hurt to ask, especially considering so many people upvoted the comment, I'm very curious about that point.
Jan
3
comment Why are there so many string classes in the face of std::string?
@CatPlusPlus Android reinvented String? Been developing for Android for years, but no idea what you mean.
Nov
27
comment Would UTF-8 be able to support the inclusion of a vast alien language with millions of new characters?
@Voo I linked the source file for the internal representations of strings in Android runtime, and it clearly doesn't use UTF-8. Maybe you meant something else by NDK string, in that case you should clarify that. As for JEP 254, it just says that when it's possible to store as ISO-8859-1, the strings should be stored as ISO-8859-1, but I wouldn't say this means they "do not store strings as UTF-16 except when necessary". It even explicitly says that storing strings as UTF-8 is a non-goal.
Nov
27
comment Would UTF-8 be able to support the inclusion of a vast alien language with millions of new characters?
@Voo Judging by runtime/mirror/string.h, Android clearly stores string in UTF-16 internally. Same thing with OpenJDK 8. So what you're saying about Java is untrue. But regardless it is much more important what the programmers are working with and not what Google decided to write for their own use, and the other programmers have to work with UTF-16 since this is how Java strings are represented.
Nov
25
comment Should one check for every little error in C?
How is this a duplicate? The other question speaks about a piece of Java code with a boolean, this question asks about the specifics of C error handling. Did the ones who closed it even read the other question besides its title? This zealous desire to close everything on this site has always been unpleasantly surprising to me, now it's even worse with the new "three-close-votes" rule.
Nov
25
comment Would UTF-8 be able to support the inclusion of a vast alien language with millions of new characters?
@slebetman Not really. Anything JVM-based uses UTF-16 (Android as well, not sure why you say it doesn't), JavaScript uses UTF-16, and given that Java and JavaScript are the most popular languages, UTF-16 is not going anywhere anytime soon.
Nov
24
comment Would UTF-8 be able to support the inclusion of a vast alien language with millions of new characters?
The only real problem with UTF-16 is that a lot of software implements UCS-2 and says that it implements UTF-16. I know this sucks, but unless you have a time machine to wipe out UCS-2 existence, this can only be changed by fixing the legacy software. Complaining about it in every post about Unicode won't help. The question doesn't even mention UTF-16, why does this answer talk about it even more than UTF-8?
Sep
18
comment Why isn't functional language syntax more close to human language?
I was going to say, even Brainfuck is designed by humans, but I doubt anyone would argue that the difficulty of understanding programs written in it "is a matter of opinion and familiarity." This answer just nitpicks on the question, the OP meant natural languages.
Sep
28
comment Why is type inference useful?
Some examples are a bit contrived, in my opinion. Initialization to 42 doesn't automatically mean that the variable is an int, it could be any numeric type including even char. Also I don't see why you would want to spell out the whole type for the Entry when you can just type in the class name and let your IDE do the necessary import. The only case when you have to spell out the whole name is when you have a class with the same name in your own package. But it seems to me like bad design anyway.
Jul
25
comment I don't understand the arguments against operator overloading
Yet we have a << operator defined on streams which has nothing to do with the bitwise shift, right in the standard library of C++.
Jul
25
comment Why do old C-style method names continue being used in modern languages?
Yes, it works that way with given names. They are given randomly at birth when no one has even a slightest idea what the person is going to be like. You aren't saying that programmers usually pick a random name for the function, and then make it do something, are you? Even if some do, that's obviously a very poor programming style.
Jul
24
comment Why do old C-style method names continue being used in modern languages?
I don't think it's a good analogy. With given names, no one cares about the meaning behind the name because it has nothing to do with the actual person. With the method names it's quite the opposite: the closer the function name is tied to what it does, the better. It's not just a label.
Jul
15
comment Necessity to learn haskell language extension for production
@Davorak That's exactly the problem I'm talking about: everyone uses GHC, because this is the only still actively maintained compiler. Other compilers can't keep up, so no one can use them, and there's little reason to invest in them. As for the libraries: you pick libraries for the problem and work only with them. Say, if you need to read XML, you need just one XML-reading library. With extensions, however, it's not obvious when you need which. Though there's a problem with libraries too. Say, in Java there're just arrays and collections, and in Haskell there's a load of array libraries.
Jul
14
comment Necessity to learn haskell language extension for production
@Davorak Because instead of a single language we have zillion of different extension combinations, and you don't know anything about whether the code is going to compile on a certain compiler. Extensions make the code non-portable. And also this makes the language a pain to learn because instead of a single set of features which everyone uses there is tremendous amount of additional features, and you haven't got a clue which ones you have to know and use and which ones exist just because researchers are having fun.
Jun
25
comment Necessity to learn haskell language extension for production
"And that is true for any language/tool" - that's completely false. Say, take such languages as Java, C#, C++ - none of them have language extensions which are commonly found in real world applications code. If you have to use language extensions every time you need to write anything less trivial than "the online contest problem solutions", in my opinion, there's something very wrong with the language spec.
Feb
4
comment Replacement for instanceof Java?
I'd say that's not always the case that you have to add the method to the class. For example, some code gets an exception and is supposed to do something with it depending on its type. Say, makes a report or does something to recover from error. This kind of functionality definitely doesn't suit the exceptions. Or, if the classes come from some external library, then you don't even have the means to modify these classes. In this case I think it is absolutely valid to rely on the instanceof.
Nov
21
comment Is there an excuse for short variable names?
I usually don't write i, j, k, I write something like personPos because then I won't forget what I'm iterating on and what the index represents.
Nov
20
comment Why aren't more desktop apps written with Qt?
@BillyONeal If you compare the amount of code, then you may give an edge to the languages that exist for a longer time but not necessarily are popular now. And also code in open source projects doesn't necessarily reflect the languages used in production. There is no accurate measure, you just have to select some parameter and stick to it.
Nov
8
comment Why does Java use UTF-16 for internal string representation?
Here is a quote from the Unicode FAQ: Originally, Unicode was designed as a pure 16-bit encoding, aimed at representing all modern scripts. (Ancient scripts were to be represented with private-use characters.) Over time, and especially after the addition of over 14,500 composite characters for compatibility with legacy sets, it became clear that 16-bits were not sufficient for the user community. Out of this arose UTF-16. At the time of Java release UTF-16 hasn't yet appeared, and UTF-8 was not a part of Unicode standard.
May
23
comment Who was the first programmer?
It always seemed a little strange to me that Babbage himself is not considered the first programmer. How can you design a machine and not make some algorithms for it in the process? Of course, this is a beautiful legend, and I'm kind of trying to make things more prosaic, so I'm sorry about that.