7,759 reputation
11835
bio website
location
age
visits member for 3 years, 5 months
seen 4 mins ago

Mar
30
comment Why do higher level languages have neither xor nor nand short-circuit operators?
@Netch There's only ambiguity if you talk about an n-ary extension of the XOR operation, but the standard definition is a binary (2-ary) operation, and I see nothing in the question or comments indicating that OP is asking about a n-ary extension.
Mar
30
comment Why do higher level languages have neither xor nor nand short-circuit operators?
@Duncan I meant: The XOR operation can't possibly be implemented to short circuit; regardless of the value for the first operand, you always need the value of the second operand to determine the result. 0 AND x is always 0, 1 OR x is always 1, but both 0 XOR x and 1 XOR x can be both 0 or 1 depending on x.
Mar
30
comment Why do higher level languages have neither xor nor nand short-circuit operators?
You can't short circuit XOR.
Mar
26
comment Is declaring STL variables in a class definition too revealing?
What does any of this have to do with either STL data types or standard library types? The same question applies unaltered if the private data is anything else at all, doesn't it?
Mar
26
comment Why aren't we all compromised on the internet?
Perhaps someone got your password and you didn't realize it? ;-) I don't know what sites you frequent that need a password, but most of them are probably pretty major hubs, grown over many years, with hundreds of thousands, possible millions of users and a serious company behind them. While that's far from a guarantee, it does imply that they've had plenty of time and opportunity to find and fix the obvious holes -- either proactively, or because the hole was used for an earlier attack.
Mar
26
comment Why aren't we all compromised on the internet?
There are many XSS attacks, and some of them are successful. And countless other attacks too. Security is hard, it's just not as fundamentally intractable as you seem to think. You appear to assume it's all but impossible to prevent even the most amateurish attacks, why?
Mar
24
comment Is open-sourcing previously-commercial engines a smart move?
Unless I seriously misunderstood something, Unreal Engine 4 isn't going open source in the usual sense of the word. Every customer gets full source code, and that's great, but you still have to pay at least once for a license to use it, if you make money from it Epic gets royalties, and you can't (legally) fork it and give the source code away. That's not even freeware, let alone open source. Or are you misusing "open-sourcing" to mean "giving a lot of people access to the source code"?
Mar
23
comment Why did the Sun engineers decided to make Java only call by value?
The Java community seems to have settled on "pass by value" with the pre-emptive clarification that for classes, the value being passed is an object reference. There are some other languages with nigh-identical parameter passing strategy; some of those invent new terms. Two alternatives used in the Python ecosystem are "call by object" and "call by sharing".
Mar
22
comment Why did the Sun engineers decided to make Java only call by value?
The traditional, widely used, and IMHO far more useful definition of "pass by reference" has nothing to do with the things called references in Java, the former referring exclusively to things like C#'s ref and out. Saying that Java does pass by reference both ignores a much older definition of the term and confuses distinct concepts that unfortunately share a name.
Mar
22
comment Why did the Sun engineers decided to make Java only call by value?
@JörgWMittag ... I do agree that variables and values are distinct entities (clearly 1 is not a variable). But I consider variables of value type values. As far as I can tell, this is a standard view, and it does not appear to lead to any faulty conclusions. And thus, when I say "int is mutable", I do not claim that all values of type int can be changed, I claim that some such values (namely those that are variables, fields, array slots, etc. and not final) can be changed, by replacing them with a copy of another value.
Mar
22
comment Why did the Sun engineers decided to make Java only call by value?
@JörgWMittag It appears you are using a very different, less common (and IMHO less useful) definition of "value". When I say "the value 1" I don't refer to some platonic mathematical entity; I mean any part of memory that equals the constant 1. That includes variables of type int, because (unlike with reference types such as your MutableInt) the variable actually holds that value, not a reference to a value elsewhere. In other words, x is as much of an int value as y in MutableInt is a reference. Which brings me to the gist, which only illustrates that int is a value type...
Mar
21
comment Why did the Sun engineers decided to make Java only call by value?
@RobertHarvey But it's a lot closer than C++. As in Lisp, Java has no concept of memory or memory management, it only has values/objects. As in Lisp, everything's a reference type (with the ugly exception of primitives, a concession to performance).
Mar
21
comment Why did the Sun engineers decided to make Java only call by value?
@JörgWMittag x is not a reference to an int object. It is an int, but it is not the number 1. x = 1 meant "copy the value 1 into x", not "make x refer to 1". There are thirty two bits somewhere in computer memory, they used to be 00...001 and now they're 00...010 - sounds like mutation to me. Expecting mutation of the concept of the number one would be a bit silly, wouldn't it? (Though I've heard anecdotes of the very first FORTRAN compilers allowing such fun.)
Mar
21
comment Why did the Sun engineers decided to make Java only call by value?
In what sense of the word are primitives immutable? int x = 1; x = 2; works, doesn't it?
Mar
20
comment Is a genetic algorithm needed when computation is infinitely fast?
Well, unless weird physics like closed timelike curves (near the end) turn out to work and can be exploited for general-purpose computation.
Mar
17
comment Complete immutability and Object Oriented Programming
@Revious Yes, reading would be slower, though not as slow as changing a string (the traditional representation). A "string" (in the representation I'm talking about) after 1000 modifies would be just like a freshly created string (modulo contents); no useful or widely used persistent data structure degrades in quality after X operations. Memory fragmentation is not a serious problem (you'd have many allocations, yes, but fragmentation is well a non-issue in modern garbage collectors)
Mar
17
comment Complete immutability and Object Oriented Programming
@Hyperboreus I lean towards Robert Harvey's answer, but would like to actually try using such a language (or at least think long and hard about how it would work) before making a judgement call.
Mar
17
comment Complete immutability and Object Oriented Programming
@Revious Any persistence "sequence" data structure works, really. For example, Finger Trees of chars would support efficient (in the amortized time complexity sense) concatenation, splitting, removal at any index, insertion at any index, etc.
Mar
17
comment Complete immutability and Object Oriented Programming
@MichaelT Feel free to point out anything I missed, but you only seem to make a case for immutability being sometimes beneficial, not for "complete" immutability, and not whether mutability is sometimes beneficial or even necessary.
Mar
17
comment Complete immutability and Object Oriented Programming
@MichaelT The question is not about making specific things mutable, it's about making all things immutable.