Forum > General

RTL Namespaces

<< < (4/5) > >>

marcov:

--- Quote from: PascalDragon on June 16, 2022, 11:01:22 am ---Once units are namespaced (and assuming that their base name stays the same) you can simply use the already existing -FN option to define default namespaces. E.g. -FNSystem with a unit Classes will lead to the compiler looking for both System.Classes and Classes. So you can keep the source the same, but just adjust the compilation parameters.

--- End quote ---

(and that is also what I do on the delphi side. But not everbody does, and in my experience the last 5-8 years the bulk of Delphi users seem to  have moved from the eternal D7 to unicode versions, and pretty new ones even)

MarkMLl:
Allowing that this is probably a minority position, but could I highlight a use case and ask whether any change relating to namespaces etc. would cause problems.

For some years I have used a program organisation where a library- perhaps a backend to interface to a specific physical instrument- can be linked either statically (ordinary "uses" clause) or dynamically (run-time dynamic loading of a .so or .dll).

If the linkage is static, the library (e.g. Dso112a) appears to be a unit and functions it exports may be accessed as e.g. Dso112a.MagicNumber().

If the linkage is dynamic, the library is an instance of a class wrapping the .so or .dll, loading the binary and finding entry points at first use. Exported functions/methods may again be accessed as e.g. Dso112a.MagicNumber() where in this case Dso112a is the name of an instance.

Could the introduction of namespaces mess up this convention? If so, is there an elegant workaround?

MarkMLl


PascalDragon:

--- Quote from: MarkMLl on June 16, 2022, 11:37:16 am ---Could the introduction of namespaces mess up this convention?
--- End quote ---

Why should it? We're talking about introducing namespaces for the RTL, FCL, LCL units, not your own. And the mechanisms for these are already in place since 3.0.0 (namespace support itself) and 3.2.0 (the -FN-parameter).

MarkMLl:

--- Quote from: PascalDragon on June 17, 2022, 09:13:37 am ---
--- Quote from: MarkMLl on June 16, 2022, 11:37:16 am ---Could the introduction of namespaces mess up this convention?
--- End quote ---

Why should it? We're talking about introducing namespaces for the RTL, FCL, LCL units, not your own. And the mechanisms for these are already in place since 3.0.0 (namespace support itself) and 3.2.0 (the -FN-parameter).

--- End quote ---

Thanks, I was just being very cautious :-)

MarkMLl

deadserious:
What i think I'll do is build a tool that updates RTL units with namespaces and rebuilds the libraries so that people who wish too have a namespaced rtl can.  It would just require running the tool after updating fpc.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version