12,727 reputation
13155
bio website
location
age
visits member for 4 years, 2 months
seen 15 mins ago

Feb
15
comment Text Editor Document Model
A linked list of characters, for a text editor?!? That easily makes the document take five times as much space as necessary! Nine times on 64 bit machines. Not to mention that many operations will become severely less efficient due to your code going crazy hopping all over memory. Why do you think you need a linked list?
Feb
15
comment What's the effect of this assignment (whatever the language)?
@KeithThompson I stand corrected, thanks!
Feb
14
comment Why does the .Net world seem to embrace magic strings instead of staticly typed alternatives?
@Earlz More importantly, anonymous objects are statically typed. There are no magic strings, the compiler knows the name and type of everything involved. Save for every other use of var.
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.