Reputation
16,606
Top tag
Next privilege 20,000 Rep.
Access 'trusted user' tools
Badges
1 42 66
Newest
 Good Answer
Impact
~236k people reached

Feb
14
comment Why does the .Net world seem to embrace magic strings instead of staticly typed alternatives?
My humble guess is that the properly statically typed alternative is too freaking inconvenient. That's a theme that turns up a lot with most type systems really: "We'd like to do this in the type system, but it's not expressive enough." (Or the inverse: "We successfully expressed this in the type system, but it made things three times as complex.") @GlenH7 I'm not terribly familiar with all of LINQ, but the bits I've used don't exhibit anything even near what this post describes. Care to give an example?
Feb
14
comment What's the effect of this assignment (whatever the language)?
@JohnR.Strohm "It's implementation-defined" is another answer that may or may not be correct, depending on the language ;-) Though I must say I can't think of a single language that make it implementation dependent - it's usually either well-defined or undefined (in the same sense as in the C and C++ standards; i.e. relying on it makes your program invalid and implementations are not required to be consistent or even sensible about what they do with it).
Feb
14
comment What's the effect of this assignment (whatever the language)?
The title indicates a wrong premise, this depends entirely on the language. (Specifically on a detail that might be considered small enough to differ among two "X-like languages", which makes it kind of hard to give a clear-cut answer.)
Feb
14
comment Elemental access in arrays
@TheSilverBullet List<T> consists basically of a T[] and a bit of metadata. The T[] is almost always larger than necessary for the current amount of elements, which is necessary to allow efficient appending (i.e. more efficient than allocating a new T[] and copying all elements on every appending). This is also called a dynamic over-allocating array.
Feb
13
comment A question regarding linked list vs vector insert/remove results comparison
With today's architectures, it's quite likely that even sequential access is way faster with the array than with the linked list, as it's much cache friendlier and requires less indirection.
Feb
13
comment Elemental access in arrays
@BenjaminGruenbaum A data structure need not be modeled after anything in real life. It only need support the operations my algorithms need efficiently. And there are countless useful algorithms on array-ish data structures, and countless data structures (again with many applications) that can be built atop of arrays. Are you telling me you never use the random access capability? (Note that the resizing restriction is only theoretic; it's trivial to build a dynamic array that supports O(1) appending atop of a static array. This makes it quite efficient for stacks and many other use cases.)
Feb
13
comment Why Was Python Written with the GIL?
s/RPython/PyPy/g. @MichaelBorgwardt Giving reasons pro GIL is kind of the point of the question, isn't it? Though I would agree that some of the contents of this answer (namely discussion of alternatives) is beside the point. And for better or for worse, refcounting is now almost impossible to get rid of -- it is deeply ingrained in the entire API and code base; it's almost impossible to get rid of it without rewriting half the code and breaking all external code.
Feb
13
comment Elemental access in arrays
If it doesn't have random access, it's not an array. Unless you're making up terms and ignoring standard CS definitions that are older than most people working in the field.
Feb
13
comment Elemental access in arrays
@BenjaminGruenbaum It provides random access. If you think of it as a sequential structure, as the quote in the question demands, that's fine, but that doesn't make them a priori exempt from the question of whether to use their random access capability. NB I also don't think of a plain array in terms of physical memory or pointers; I think of it as a sequence that provides O(1) random access and (in its basic form) no resizing.
Feb
13
comment Elemental access in arrays
@BenjaminGruenbaum Assuming that by lists you mean List<T>, that's an just array.
Feb
10
comment var args constructors/methods vs lists
With varargs, I don't have to explicitly assemble a collection if I already have the items. Even with the most convenient syntax available in C# right now, it's Foo(new List<SomeHugeType> {param1, param2}) versus Foo(param1, param2). And ambiguity of calls is more effectively battled by restricting overloading in general ;-)
Feb
9
comment Why does the backing store of an array bind to the smallest type?
I don't see how inlining enters the picture (then again, I'm not yet sure what that entire paragraph says) -- it's an optimization, it's not supposed to alter program semantics in any way.
Feb
9
revised Why does the backing store of an array bind to the smallest type?
added 154 characters in body
Feb
9
comment Why does the backing store of an array bind to the smallest type?
@svick Okay, noted (though I still think it would make the implementation more complicated, by further diverting arrays-of-values from arrays-of-references).
Feb
9
revised Why does the backing store of an array bind to the smallest type?
added 154 characters in body
Feb
9
answered Why does the backing store of an array bind to the smallest type?
Feb
1
comment How is C/C++ more difficult to decompile than C#?
@Michael By default, the names are kept IIUC (your very own code may rely on it, e.g. if it uses reflection). But even if you use these names in other assemblies, it should be relatively straightforward to replace them with arbitrary strings, and IIRC most "obfuscators" for .NET do that.
Feb
1
comment How do programming languages benefit from being based on English?
@EvanPlaice Yeah, it's debatable how unnatural these really are. There's clearly some merit to them, else they would have been abolished long ago. I can't judge if they generally help native English speakers, I just know that the equivalent (choosing the closest translation, then constructing equivalent analogies with that translation) tends to build wrong associations in students' brains. Re translations: Yes, it's no surprise that there are similar words; I was aiming at the "there were more shortened words and weird abbreviations than full words" bit of the question.
Feb
1
comment What is the advantage of currying?
@MasonWheeler Your have a point w.r.t. the phrasing of this answer, but let me chip in and say that the amount of stack frames actually created depends a lot on the implementation. For example, in the spineless tagless G machine (STG; the way GHC implements Haskell) delays actual evaluation until it accumulates all (or at least as many as it knows to be required) arguments. I can't seem to recall whether this is done for all functions or only for constructors, but I think it ought to be possible for most functions. (Then again, the concept of "stack frames" doesn't really apply to the STG.)
Feb
1
revised How do programming languages benefit from being based on English?
added 253 characters in body