mailinglists at geldenhuys.co.uk
Fri Apr 3 13:56:59 CEST 2015
On 2015-04-03 12:35, Marco van de Voort wrote:
>> > That way we don't need $IFDEFs or special Unit Search Paths, just
>> > specify "FMX" or "VCL or "LCL" in the Project Unit Scope names list.
>> > You then simply refer to those units in your uses clause by using:
> Not entirely, since you can afaik use the whole unit names qualified ?
I understand that, but in the context of the example, the tiOPF project
has different implementations of the same functionality for different
GUI toolkits. So in that case the developer would use the partial
namespace unit name (tiMediator or tiListMediator) in the uses clause,
and the compiler will figure out which fully quality unit you mean, by
looking at the Namespace Scope List.
In my other example with using very generic unit names (eg:
constants.pas), then you would opt to use the fully qualified unit name
in the uses clause to tell the compiler which unit you are referring too.
So those are two very different situations and uses of the namespace
feature. Like I said, I've never used namespaces personally, but I'm
sure more usage examples exist. I think it is quite a useful feature,
and should not only be considered "cosmetic unit names".
- Graeme -
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
More information about the fpc-pascal