[fpc-pascal] Looking for JavaScript component on FPC

Graeme Geldenhuys mailinglists at geldenhuys.co.uk
Fri Apr 3 11:20:13 CEST 2015


On 2015-04-03 08:09, Michael Van Canneyt wrote:
> To be sure, it was introduced to be delphi compatible.
> Whether namespaces are 'modern','advanced' or not is a matter of debate. 
> In the end (at the assembler level) it's all a flat namespace anyway.

But namespaces are functional in Delphi - not just cosmetic. So are you
saying that FPC doesn't have the same functional ability as Delphi when
it comes to namespaces?

The following is how somebody explained Delphi namespaces to me:

In stead of having directories like this with the same unit names and
having to use IFDEF's and play with unit paths...

/GUI/VLC/tiMediators.pas
/GUI/VLC/tiListMediators.pas
/GUI/LCL/tiMediators.pas
/GUI/LCL/tiListMediators.pas
/GUI/FMX/tiMediators.pas
/GUI/FMX/tiListMediators.pas

...instead you can flatten the directory hierarchy to simply a single
GUI directory as follows:

/GUI/VLC.tiMediators.pas
/GUI/VLC.tiListMediators.pas
/GUI/LCL.tiMediators.pas
/GUI/LCL.tiListMediators.pas
/GUI/FMX.tiMediators.pas
/GUI/FMX.tiListMediators.pas


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:

  uses
    tiMediator, tiListMediator;

The compiler will then know which unit to use because of the scope you
specified in the project.

I take it FPC doesn't support this then?

Regards,
  - Graeme -

-- 
fpGUI Toolkit - a cross-platform GUI toolkit using Free Pascal
http://fpgui.sourceforge.net/


More information about the fpc-pascal mailing list