Final by default?
Walter Bright
newshound2 at digitalmars.com
Mon Mar 17 01:06:34 PDT 2014
On 3/17/2014 12:39 AM, Iain Buclaw wrote:
> If I recall, he was saying that you must pass -fversion=CAIRO_HAS_PNG_SUPPORT to
> every file that imports it was the problem, because you want PNG support, not stubs.
Stub out the functions for PNG support. Then just call them, they will do
nothing if PNG isn't supported. There is NO NEED for the callers to set version.
> It's more an example where you need a build system in place for a simple hello
> world in cairoD if you don't want to be typing too much just to get your test
> program built. :)
If you need to -fversion=CAIRO_HAS_PNG_SUPPORT for every file that imports it,
you have completely misunderstood the design I suggested.
1. Encapsulate the feature in a function.
2. Implement the function in module X. Module X is the ONLY module that needs
the version. In module X, define the function to do nothing if version is false.
3. Nobody who imports X has to define the version.
4. Just call the function as if the feature always exists.
5. If you find you still need a version in the importer, then you didn't fully
encapsulate the feature. Go back to step 1.
More information about the Digitalmars-d
mailing list