Duncan Gibson wrote:
>>> ...  renam[ing] of everything from Fl_/fl_foo to fltk::foo
>>> seems like a waste of effort.
> 
>> [...]
>> I don't think Bill's idea is to rename "Fl_Foo" to "fltk::Foo",
>> but to use the pristine form: "Foo".
>>
>> Yes, it would be a substantial effort, but namespaces are probably
>> the Right Way(tm), and perhaps are worth the effort.
> 
> When it comes to actual use, I'm namespace neutral. However, during
> the process of merging fltk1 and fltk2 I can see that they are a
> double-edged sword. If fltk1 moves to namespaces early, comparison
> of code with fltk2 *may* be easier, but the existing fltk1 codebase
> then can't be used for regression testing, and there will also be a
> massive jump in the fltk1 code base that will prevent easy backtracking
> to find bugs, bug fixes and general change points[*]. If fltk1 moves
> to namespaces late, comparison is hard, but regression and tracebacks
> are easier.
> 
> Tough call.
> 
> Cheers
> Duncan
> 
> [*] Just like reformatting all fltk1 code for a new coding standard.
> 

What I was proposing is to use the fltk2 scheme, but start over from the 
current fltk1 code in order to preserve compatability. There are still 
"fl/Fl_foo.h" header files, but they are compatability wrappers around 
the new "fltk/foo.h" header files. Here is a typical example, the 
contents of FL/Fl_Button.H:

#include "Fl_Widget.H"
#include <fltk/Button.h>
typedef fltk::Button Fl_Button;
enum {
   FL_NORMAL_BUTTON     = 0,
   FL_TOGGLE_BUTTON     = fltk::Button::TOGGLE,
   FL_RADIO_BUTTON      = fltk::Button::RADIO,
   FL_HIDDEN_BUTTON     = fltk::Button::HIDDEN // may not work in 2.0
};

This uses a typedef to make Fl_Button be the same as the new 
fltk::Button object. It also uses the enum to copy fltk:: enumerations 
to the FL_ names.

One problem with fltk2 is that this was not done *first* and 
back-compatabilty was not checked and preserved. Instead many changes 
were made before the namespace was done.
_______________________________________________
fltk-dev mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk-dev

Reply via email to