Why Do I Torture Myself With C++?

C++ is an amazing tool overall, but for small projects, I find myself wondering why I even bother with it. I’ve always hated the hoops that C++ makes me go through when compared to other languages like Java and Python. One of the biggest annoyances for me is the separate declaration/implementation — I really like being about to define my classes and their functions all in a single file.

Anyway, the reason I’m posting today is this. This original poster in this thread is trying to setup a state machine by using C++ classes. The idea is that the class type would change when the state is changed. But, without going into ugly hacks in C++, you just can’t do it. Unless I’m mistaken, you can’t even do that in Java.

On the other hand, the Python implementation is perfect. I don’t think you could make it simpler than that.

It’s a real shame that I can’t use Python more.


About this entry