On Tue, 25 Oct 2005, Phil Tomson wrote:
> It's often said that learning a new language will help you look at things
> differently and thus also improve how your program in other languages you
> know. I occasionally program in C++ and I'm in one of those occasions now
> so I'm thinking about how knowing Ruby has influenced my C++ programming.
>
> One thing that comes to mind is that I'm more likely now to pass around
> function pointers as a way to emulate yield. The function passed in can be
> evaluated at every step of an iteration, for example, to test for some
> condition.
>
> Anyone got other examples of how your C++ programming has been influenced by
> your Ruby knowledge?
templates and generic programming: they are as close to duck typing as you
can get - implement the required signature and you're off. the vigra toolkit
i've been using is a great example of this. i've also realized the
__massive__ speed hit you incur if you write c++ without templates that i'd
say c++ is not of enough value to bother without them.
the biggest improvement, of course, is that i don't need to write much c++
anymore. ;-)
-a
--
===============================================================================
| email :: ara [dot] t [dot] howard [at] noaa [dot] gov
| phone :: 303.497.6469
| anything that contradicts experience and logic should be abandoned.
| -- h.h. the 14th dalai lama
===============================================================================