From: Simon Strandgaard Date: 2003-10-09T19:32:35+09:00 Subject: Re: Extension Language for a Text Editor Frank Schmitt skrev i en nyhedsmeddelelse:4cfzi2lod6.fsf@scxw21.4sc... > Simon Strandgaard writes: > > > On Thu, 09 Oct 2003 06:06:32 +0900, Nikolai Weibull wrote: > > > * What would be easier to do using Ruby? > > > > undo/redo/macros.. The code which is responsible for this only takes up > > 119 lines of Ruby code. This is more complex in C++ because you cannot > > #clone arbitrary objects. > > If you are talking about user-defined class hierarchies, you *can* clone > them, as well - it just requires extra work: I know.. cloning in C++ get tiresome at that point when you have many childred. > class Base { > virtual Base* clone() = 0; > }; > > class Derived1: public Base { > virtual Base* clone() { return new Derived1(*this); } > }; This method requires typecasting if you want to do something like this: Derived *a = new Derived1(); Derived *b = dynamic_cast(a->clone()); Covariant return types is unfortunatly a relative new thing in the C++ world. class Derived1: public Base { virtual Derived1* clone() { return new Derived1(*this); } }; Derived *a = new Derived1(); Derived *b = a->clone(); > > unittesting: AEditor has about 440 testcases and 1400 assertions. > > unittesting is annoying in C++. In Ruby its easy. > > Why is unittesting in C++ annoying? I have an application with 200+ > testcases and 400+ assertions, written completely in C++. > The only thing that annoys me is that I can't easily add/remove tests > without recompiling - some day I'll have to write a ruby wrapper to do this :-) Compiling is expensive on my Pentium350 which is the fastest machine I have. GCC2.96 was quite fast... I have not yet seen any fast result with GCC3. I like templates, I like many things in C++. If I had a faster machine, then there would be no problems :-) -- Simon Strandgaard