On 12.07.2011 15:22, Matthias Melcher wrote:
>
> On 12.07.2011, at 12:19, Albrecht Schlosser wrote:
>
>>>   f:  merging F2 features into F3 will also be a lot of work
>>
>> Yes, I'm afraid that it is a lot of work. Some of this might make
>> it impossible to keep *both* compatibility layers without a lot of
>> work and maybe horrible code like "if ((a&&  !b) || (a&&  c))" or
>> similar.
>
> Ah, but that is supposed to happen in the wrapper.
>
> Let's say for example we have Fl_Browser, fltk::Browser, and fltk3::Browser. 
> Now, fltk3::Browser is currently a renamed version of Fl_Browser, so all 
> entries have a base-1 index. Let's simplify the FLTK 2 example and say it has 
> the same API, but a base-0 index as it should be.
>
> Now the F1 wrapper is:
>    Fl_Wrapper::select(int i) { fltk3::Wrapper::select(i); }
>
> And the F2 wrapper is:
>    fltk::Wrapper::select(int i) { fltk3::Wrapper::select(i+1); }
>
> Should we decide that a base-0 index is better, we modify FLTK 3, and the fix 
> the wrappers:
>    Fl_Wrapper::select(int i) { fltk3::Wrapper::select(i-1); }
>    fltk::Wrapper::select(int i) { fltk3::Wrapper::select(i); }
>
> So FLTK 3 stays free of "if (F1) { } else if (f2) { } else {...}"

That's a simple example, and of course simple examples can be shown
to work easily. I meant not only adaption of input/output parameters,
but internal differences that are subtle enough that they can not
be "fixed" in the header files. One simple example would be Fl_Scroll,
as I said already. Of course you could rewrite all sorts of interfaces
to hide the 2 more children (the scrollbars) in the group in fltk 1,
but user code that "knows" about this and does its own iteration over
the children will fail in one or the other version. Again, that's only
a simple example, but I don't know enough about fltk 2 to show a better
one. However I'm afraid there are some functionalities in fltk 2 that
changed internal behavior of classes (for a good reason) that are not
compatible with the current fltk 1.3 kernel, and this implies that we
would either have different code paths inside the classes, or that
something would fail in one or the other compatibility layer, unless
we have different classes for both (and then we would have to maintain
more or less duplicated code).

Albrecht
_______________________________________________
fltk mailing list
[email protected]
http://lists.easysw.com/mailman/listinfo/fltk

Reply via email to