52,261 reputation
10146229
bio website tech.turbu-rpg.com
location Seattle, WA
age 32
visits member for 4 years, 7 months
seen 48 mins ago
A lifelong programmer who's been coding in Delphi since its initial release and currently makes a living at it.

Feb
27
comment Why are structs and classes separate concepts in C#?
@LightnessRacesinOrbit: Actually that's exactly what I'm doing. I explain that in C#, structs have no inheritance and classes are reference types, and then demonstrate how in C++, which the OP was asking about, not following this pattern causes messes by violating Liskov Substitution and leading to issues like object slicing.
Feb
27
comment Why are structs and classes separate concepts in C#?
@AndyProwl: Perhaps it's a subjective conclusion to draw, but it's one well-supported by objective facts, which I have stated clearly. If you have facts which present support a different position, feel free to present them.
Feb
27
comment Why are structs and classes separate concepts in C#?
@BartekBanachewicz: Pray tell, which of the facts that I stated are subjective? That passing objects as values breaks polymorphism? That objects as value types requires hassles like copy constructors and causes messes like object slicing? That all the hidden gotchas that it introduces is the reason why C# and other OO languages chose not to follow C++'s object model?
Feb
27
comment Why are structs and classes separate concepts in C#?
@Mgetz: That's not object slicing; that's just non-polymorphic functions at work. Slicing is something highly unfortunate that happens when assigning a value-typed object to a derived class, that can lead to bizarre data corruption issues.
Feb
26
comment OCaml criticism: is it still valid?
@Doval: Of course you can detect overflow in hardware. Dealing with it, however, is a software matter.
Feb
25
comment When NOT to apply Dependency Inversion?
What if "your problem" is a hole in the wall? A saw would not remove it; it would make it worse. ;)
Feb
25
comment Dealing with state problems in functional programming
There's a simpler solution: when you come to a problem that's not easily modeled with FP techniques, don't use functional programming to solve it. Right tool for the job and all that...
Feb
24
comment What about LISP, if anything, makes it easier to implement macro systems?
@coredump: Turns out I was mistaken. Boo macros can actually be declared with a formal argument list; it's just that this is an optional (and unfortunately not very well-documented) feature.
Feb
24
comment Enemy AI for classic game Bubble Bobble
@Dbugger: If the map was just a grid of squares, from which each character can move in the four cardinal directions (and maybe diagonally?), Pac-Man style, this could be trivially modeled as a graph in which each square is a node and each open connection between two squares is an edge. Of course, if the world model contains gravity, then not all movement directions are equal, so that makes the calculations a bit more complicated. Try Googling "pathfinding for platformers" for some helpful research in this area.
Feb
23
comment What about LISP, if anything, makes it easier to implement macro systems?
@RainerJoswig: I'm not ignoring all that; it's my basic thesis. Lisp's syntax is stuck in the 1960s and it's carrying all that baggage around with it even to modern times, whereas newer languages are able to much more easily take advantage of research in compiler engineering and language design, and do the same interesting things that Lisp is capable of without being burdened with stuff like homoiconicity.
Feb
23
comment What about LISP, if anything, makes it easier to implement macro systems?
@zwol: As I understand it--and I could be way off, so please tell me if this isn't right--but isn't that a "whole program optimization" system that compiles everything once, generates statistical data about the project, and then runs the entire compile a second time using the data to guide its optimization efforts? That obviously would require twice as much time.
Feb
23
comment What about LISP, if anything, makes it easier to implement macro systems?
@Doval: What you're missing is that once you have a tree--particularly an object-oriented tree with nodes of different semantic types being represented by distinct classes--searching through it for various patterns can be very fast by simply applying the Visitor Pattern, especially if the visitor for a certain optimization can recognize that a particular node is irrelevant and "prune" the tree search by not visiting its subnodes at all. For example, in the Boo compiler there are 61 "pipeline steps" (also known as "passes"). Parsing takes longer than the other 60 put together.
Feb
23
comment What about LISP, if anything, makes it easier to implement macro systems?
@coredump: The system you describe is how Boo's "meta methods" work. It's a more simplified metaprocessing system, and you can write a meta method with a well-defined signature like you're asking for, but it gives up a lot of the flexibility that comes with full macros. Different tools for different tasks, basically.
Feb
23
comment What about LISP, if anything, makes it easier to implement macro systems?
@greenoldman: Pattern matching in Boo. It's implemented by a macro, as you suspected. It's possible to create some very different syntax using macros, such as a "parser generator" that is actually a parser, because macros have direct access to the AST and can rewrite it in arbitrary ways. Inside a macro body, the parser's rules on what is allowed is relaxed in some ways, so you can enter all sorts of stuff and sort it out in the macro code.
Feb
22
comment Is it bad or good to wrap mutable objects in immutable containers?
Encapsulation is a good thing. There is always such a thing as "too much of a good thing", though, and over-encapsulation can be extremely frustrating to deal with, especially if you're producing a library for another programmer to use.
Feb
19
comment Why are there so few C compilers?
(there is no more a market for proprietary compilers Tell that to the Visual Studio team...
Feb
12
comment What is the difference between a variable and a parameter?
@JörgWMittag: When all objects are reference types anyway, that's hair-splitting at best.
Feb
7
comment “Use map instead of class to represent data” -Rich Hickey
Choosing a class to represent a Person provides the immediate benefit of creating a statically-verifiable API... but that comes with the cost of limiting opportunities or increasing costs for change and reuse later on. Wrong, and incredibly disingenuous. It improves your opportunity for changing later on, because when you make a breaking change, the compiler will automatically find and point out for you every place that needs to be updated to bring your entire codebase up to speed. It's in dynamic code, where you can't do that, that you really get coupled to previous choices!
Feb
3
comment Why use try … finally without a catch clause?
@Baldrickk: Again, I said nothing about cleanup. What I said was "guaranteed reversible state changes," which is a superset of "cleanup of locals." RAII can handle "cleanup of locals" just fine, but what about when you have to set a certain state, perform an operation, and then set the state back to the way it was before? There's no way to do that in C++ without creating an entire class (which you will probably instantiate a grand total of one place in your entire codebase) to have its destructor do it for you. It's a classic example of an abstraction inversion.
Jan
29
comment Turn away a bug if no reproducible test case exists?
@Elise: You have the audacity to complain? I'll make you rue the day. Not at all. Most developers (including myself) take pride in their work and want their product to be good-quality. But in order to fix a bug, we need to know the problem, not the symptoms. When you go to the doctor with a complaint of symptoms, the doctor can examine you directly to find out what's wrong. When you come to me with a bug report, I can't do that, so I need to deduce the cause by other means. It really is that simple: if I can't find what's causing the problem, I can't fix it.