>>>>> "Lars" == Lars Gullik Bjønnes <[EMAIL PROTECTED]> writes:

Lars> Currently only caring about insets, and writing to file. (Could
Lars> also be used to write to the painter)

Lars> By doing it like this we can hide all writing and formatting
Lars> detail insete the classes derived from writer (we can use
Lars> whatever method we like format classes from Asger would possibly
Lars> be usable)

The idea looks nice.

Lars> Gains: - simplified code in insets - we ensure that all insets
Lars> can be output with all different writers - when adding new
Lars> insets, the compiler will barf unless you inplement the new
Lars> writer method in all derived classes.

The risk is that people will implement empty methods just to compile
and forget about it later... However, I agree that it will help
maintenance. 

Lars> Ok, this is likely not the perfect way to do this, but IMO at
Lars> least one thing should be kept from this: the absence of a
Lars> "code" enum/field.

Are there other places where 'code' is needed. Getting rid of it would
certainly be great. I did not understand everything in Allan's
propositions in this respect... BTW, isn't this problem related to
rtti? 

Lars> There should be no code anywhere that cares what kind of writer
Lars> it got passed.

If this is possible, then that's great.

Lars> // Pure Virtual class.  class Writer { writeInsetUrl(<data args
Lars> in inseturl>) = 0; };

Lars> class LaTeXWriter : Writer { writeInsetUrl(<data args in
Lars> inseturl>) { filestr << "\url{" << args << "}" << endl; } };

Why not directly 
  writeInsetUrl(const & InsetURL) {...}

Passing the inset is certainly simpler than a list of arguments (where
you can put arguments in the wrong order, etc.).

Lars> Well I don't know anymore, but it seemed like nice idea when I
Lars> was taking a shower. 

You should take showers more often ;)

JMarc

Reply via email to