14,270 reputation
13459
bio website
location
age
visits member for 4 years, 5 months
seen 1 hour ago

Mar
7
comment Interview Question - Adding Method to interface that has been implemented by thousands of class
What? Why? A class with a thousand subclasses is much more questionable. Some interfaces, like Iterable, Comparable, Collection, or Runnable are simply very general and apply to a lot of otherwise unrelated classes.
Mar
6
revised Why doesn't v8 compile typescript instead of javascript?
added 170 characters in body
Mar
6
answered Why doesn't v8 compile typescript instead of javascript?
Mar
5
revised Why isn't the addremove recommended by default in Mercurial?
added 41 characters in body
Mar
5
answered Why isn't the addremove recommended by default in Mercurial?
Mar
4
comment Origin of naming generic types as T?
I think the convention is also strong in some lineages that couldn't have been influenced by Pascal/Delphi/C#, such as and C++ and Java.
Mar
3
comment Is a 'least significant bit' used anywhere practically today?
As far as I know, "least significant bit" is merely a name for the bit in a word with the smallest positional value. I am not aware of any "format" or encoding that goes by that name. Are you perhaps confusing this with the terms big endian and little endian?
Mar
3
comment Algorithm to 'segment' a number into blocks of n?
Divide the input number by the number of nodes, scatter the remainder among some subset of the nodes. What's so hard? (Now if the work per number is not uniform, things would get more interesting...)
Mar
2
comment How can frond-end developer support different encoding (UTF-8 , UTF-16,..)other than ASCII?
@JerryCoffin I asked for a string processing problem. I am quite sure that no customer has ever needed a program that takes a string and extracts the Nth code point. To the best of my knowledge, it's only used by some algorithms that solve such customer demands. And UTF-8 has advantages other than space savings: For starters, it's more ASCII-compatible, which helps with legacy systems (including C libraries using 0-terminated strings). I would also argue that making codepoint access harder is good, as it nudges beginners in the right direction (towards the concept of grapheme clusters).
Mar
2
comment How can frond-end developer support different encoding (UTF-8 , UTF-16,..)other than ASCII?
@JerryCoffin Given all these problems, I can not seriously consider your suggestion as an alternative. (But yes, one could ignore the problem in the spec and leave that for the implementation to figure out.)
Mar
2
comment How can frond-end developer support different encoding (UTF-8 , UTF-16,..)other than ASCII?
@JerryCoffin Please give me an example of a string processing problem that is hard or "impossible" to solve efficiently with UTF-8 but easy with UTF-32. Note that it's easy to extract a code unit from a UTF-8 string if you have its byte index, so it would have to be a problem where the code point index is produced in a way that's not trivial to adapt to produce byte indices (e.g., substring search or string length)
Mar
2
comment How can frond-end developer support different encoding (UTF-8 , UTF-16,..)other than ASCII?
@JerryCoffin That (alternate file stream) is even worse. It's not portable across file systems, it gets dropped on copy & paste or when passing through anything that's not a file system (e.g. HTTP or FTP or similar file transfer), it's harder to edit, and most people don't even know it exists. It also leaks file system details into the language specification.
Mar
2
comment How can frond-end developer support different encoding (UTF-8 , UTF-16,..)other than ASCII?
@JerryCoffin UTF-32 is not only wasteful, it is pointlessly wasteful: The only operations it speeds up or makes easier are those that are subtly wrong anyway (mistaking code points for grapheme clusters), and I've yet to encounter any real string processing problem for which random access to code points is useful. Read the UTF-8 Everywhere Manifesto, especially the FAQ.
Mar
2
comment How can frond-end developer support different encoding (UTF-8 , UTF-16,..)other than ASCII?
@JerryCoffin Where should that separate metadata go that's more reliable than the alternative? In a separate file? That gets lost easily, especially when sharing code. Restricting the prefix until the encoding cookie to ASCII-like works well enough, especially for programming languages.
Mar
2
comment How can frond-end developer support different encoding (UTF-8 , UTF-16,..)other than ASCII?
@JerryCoffin Well, it affects the contents of string literals, unless you go the crappy route of declaring those byte strings without known encoding. Otherwise you want to normalize the strings to some encoding (please UTF-8) so the program doesn't need to care about the source code encoding.
Mar
2
answered How can frond-end developer support different encoding (UTF-8 , UTF-16,..)other than ASCII?
Mar
2
comment How can frond-end developer support different encoding (UTF-8 , UTF-16,..)other than ASCII?
Let's call your language Foo. My question is what is UTF-{8,16,32} etc. encoded: The Foo source file in which the Foo program is stored, or the inputs and outputs of the Foo program?
Mar
2
comment How can frond-end developer support different encoding (UTF-8 , UTF-16,..)other than ASCII?
Are you talking about the source code encoding, or the language providing the ability to write programs supporting various encodings?
Mar
2
comment Is functional language without runtime written in C possible?
It's certainly possible. If nothing else, one can program all those bits in machine code and let the compiler add them to all programs. But I suppose you were looking for something more glamorous?
Mar
1
comment Why aren't “fat binaries” more widely used for cross-platform applications?
I don't know a lot about fat binaries, but don't they need support from the OS (specifically the loader)? Then I don't see the appeal for "multi-OS software" specifically, as there's no way the OS vendors would agree on an interoperable format.