Final by default?

Walter Bright newshound2 at digitalmars.com
Mon Mar 17 12:52:15 PDT 2014


On 3/17/2014 11:46 AM, Johannes Pfau wrote:
> With versions the user has no way to know if the library actually
> supports PNG or not. He can only guess and the optional case can't be
> implemented at all.

I don't know cairoD's design requirements or tradeoffs so I will speak generally.

I suggest solving this by raising the level of abstraction. At some point, in 
user code, there's got to be:

     if (CAIRO_HAS_PNG_SUPPORT)
         doThis();
     else
         doThat();


I suggest adding the following to the Cairo module:

     void doSomething()
     {
       if (CAIRO_HAS_PNG_SUPPORT)
         doThis();
       else
         doThat();

     }

and the user code becomes:

     doSomething();



More information about the Digitalmars-d mailing list