11,805 reputation
12852
bio website
location
age
visits member for 4 years, 1 month
seen 3 hours ago

1d
answered How early does a hashable type need to become immutable?
1d
comment How early does a hashable type need to become immutable?
The code is runnable, if you concatenate the two snippets and replace the bare value in Baz.__init__ with any concrete value.
Dec
17
comment Why are Scala's Either and Option types not interfaces/traits but classes?
What's wrong with Either[CompileFailure, CompileSuccess]?
Dec
13
comment Maintenance cost of SIMD programming code base
This is far too long for a question, most likely because a good chunk of it is effectively an attempt to answer the question, and long even for an answer (partly because it touches on far more aspects than most reasonable answers do).
Dec
10
comment Is there ever a reason to use an array when lists are available?
List<T> also offers random access. Sure, it's implemented with an array, but that doesn't need to bother you, the user. So at best, you offered a single reason to use arrays: To implement List<T>.
Dec
10
comment Is there ever a reason to use an array when lists are available?
The size of arrays is not set in stone at the time one writes code. It can, and often is, a run-time variable. It just never changes after the array has been created.
Dec
9
comment Why isn't software abstract on a grander scale?
The duck typing concept is being applied to modules (some modules are designed as drop-in alternatives), but just as with regular duck typing, it doesn't fall out "for free" out of having roughly similar functionality. Once you set the API in stone, there isn't a whole lot a second implementation can do to improve upon the first implementation. For example, people use requests because its API differs from urllib. If it stuck to the API, it would have no benefits (and the downsides of being less mature and battle-hardened).
Dec
9
comment Why isn't software abstract on a grander scale?
On the other side of the coin: YAGNI. You Ain't Gonna Need It. Requirements change, but generally people do a poor job at predicting how they change, so when they try to abstract out everything, they also abstract things that never actually change and overlook things that do change. It's a cost/benefit thing, not just a shortsightedness thing (though that certainly also plays a role).
Dec
7
awarded  Announcer
Dec
7
comment Historical precedent for why Prolog is less popular than SQL in Imperative Programming?
Most of the text sounds like a rant against people who don't use Prolog. There is a question worth asking contained in it, but the other stuff (the rant) attracts downvotes and turns off people who could contribute an answer. In other words, I suggest you try phrasing your question in a more charitable way.
Dec
7
comment Historical precedent for why Prolog is less popular than SQL in Imperative Programming?
You might want to dial down the rant aspect.
Dec
6
comment Why is the hashCode method usage of HashSet not specified in the API?
The HashSet documentation does not, technically, need to specify that hashCode: The contract that equality implies equal hash codes is a general contract on Object#hashCode, so it applies to all objects. All code is within its rights to use hashCode and assume that contract holds. That said, given that many beginners do not read that part of the documentation, and that many other resources felt the need to mention it explicitly, it certainly would be more useful if the JavaDoc highlighted this aspect.
Dec
6
comment Why do we have to mention the data type of the variable in C
Actually those two programs are not equivalent, in that they may give slightly different outputs! 5.2 is a double, so the first program rounds the double literals to float precision, then adds them as floats, while the second rounds the double representation of 5.1 back to double and adds it to the double value 5.2 using double addition, then rounds the result of that calculation to float precision. Because the rounding occurs in different places, the result may dffer. This is just one example for the types of variables affecting the behavior of an otherwise identical program.
Dec
1
comment What argument passing mechanism does python use, and where is this officially documented?
In C, a pointer is a value in its own right. It has an address, you can do arithmetic with it, you can output it, and so on. That's not true for references in Java or Python (or C++ references, incidentally, even though those are very different in other areas). And yes, for the third time, I'm not saying pass by value is the wrong term (I've defended for that term a dozen times myself), I'm saying it is not the best term.
Dec
1
comment What argument passing mechanism does python use, and where is this officially documented?
Let me put it that way: In Python, "value" is an overly broad term. What's actually being passed is always the value of a reference (so it's kind of a special case), and "value" is commonly used to refer to an object's internal state (which is never passed). For these and other reasons, people argue that "pass by value", while technically accurate, is not the best wording to describe Python's behavior. The notion that argument passing is either by value or by reference dates back to a very early age of computing, where programming languages semantics were somewhat different.
Dec
1
comment What argument passing mechanism does python use, and where is this officially documented?
Cross-language consistency is nice, but why should the Python folks use the Java terminology rather than the other way around? There are good arguments to discard the value/reference binary. Moreover, in Java there are primitive types which are passed by value in the most traditional sense, while in Python there aren't.
Dec
1
comment Is generating a large random number more unique than generating each digit in that number?
Generating digit by digit is a significant extra effort (primarily for you) and another source of potential bugs. So unless generating digit by digit actually results in higher quality numbers (which you don't seem to believe either, from the phrasing of the title), no it does not make sense.
Nov
29
comment Is there any license which prohibits usage for hiring purposes?
FYI such a license would not be an open source license (discrimination against fields of endeavor).
Nov
29
comment What is the point of making a syntactic distinction between standard and user-defined types?
@RobertHarvey Are you saying Hungarian notation only ever existed in C, C++ and VB? Regardless, my point was to question the reason you give for it being frowned up upon (that it's redundant only since we have IDEs that tell you the type) since that reason doesn't apply to languages that don't have such IDes and, by your reasoning, should benefit from Hungarian. That Python is dynamically typed makes no difference, in fact it should enhance the reasoning since typically the programmer knows the types when writing the code, but they can't be inferred automatically.
Nov
28
comment What is the point of making a syntactic distinction between standard and user-defined types?
@RobertHarvey No, I'm aware of both ("apps Hungarian" and "systems Hungarian"), and in my experience neither is common in, for example, Python and Rust.