Forum > General

RTL Namespaces

<< < (3/5) > >>

deadserious:

--- Quote from: marcov on June 15, 2022, 10:14:35 am ---I simply work the other way, I enter the skip namespace tag in Delphi, and rename all my units on that side.

--- End quote ---

Since anonymous methods are now supported, I'm trying to check compatibility with all of my open source libraries. They all already use namespaced units. I'd rather not despecify in my code and instead spend my time contributing to get fpc up to speed.

But if the work will end up not being accepted, it's not going to be worth my time.

deadserious:

--- Quote from: PascalDragon on June 15, 2022, 02:19:59 pm ---It won't be fully compatible anyway. E.g. unit Contnrs might just as well be placed in FCL.Contnrs instead of System.Contnrs (I'm not saying that it will be, but it's at least a possibility). And the LCL units on the other hand will very likely use LCL as prefix instead of VCL.

--- End quote ---

I'm not expecting VCL.* to be compatible with LCL.* lol.

But like units in the RTL should be namespaced to match with Delphi imo.

It sounds like you disagree. It's been that sentiment that has kept me from fpc for so long.

avra:

--- Quote from: deadserious on June 16, 2022, 02:51:41 am ---I'm not expecting VCL.* to be compatible with LCL.* lol.

But like units in the RTL should be namespaced to match with Delphi imo.

It sounds like you disagree. It's been that sentiment that has kept me from fpc for so long.
--- End quote ---
I do not see it as a problem if some ifdefs or macros can jump in and help. It might even be that at the end most of the work is already done and transparent for you. There will never be a 100% compatibility, especially when FPC has to support embedded targets like AVR and run on old ones like DOS. But the expectation to be able to write code that compiles on both Delphi and FPC with little effort remains.

MarkMLl:

--- Quote from: jcmontherock on June 15, 2022, 04:23:43 pm ---However, for example, you can use "System.Delete()" to execute a procedure if you already have a "Delete()" procedure in your application. It's a little namespace.

--- End quote ---


--- Quote from: marcov on June 15, 2022, 04:30:39 pm ---System is also the name of the always-there unit.  This has worked since turbo pascal times.

--- End quote ---

I'd suggest that any departure from this which breaks compatibility with older FPC versions would be a very bad idea.

If we had to vote between keeping FPC compatible with both itself and older versions of Delphi, versus breaking compatibility in the name of chasing enhancements added to Delphi in its dotage, I'd be firmly on the side of tradition.

MarkMLl

PascalDragon:

--- Quote from: marcov on June 15, 2022, 03:40:36 pm ---
--- Quote from: PascalDragon on June 15, 2022, 02:19:59 pm --- It won't be fully compatible anyway. E.g. unit Contnrs might just as well be placed in FCL.Contnrs instead of System.Contnrs (I'm not saying that it will be, but it's at least a possibility). And the LCL units on the other hand will very likely use LCL as prefix instead of VCL.

--- End quote ---

I surely hope not ;)

--- End quote ---

For units that are part of the FPC distribution it might indeed be less likely that they'll have a different namespace, but I already know that dynamic packages won't be compatible, because there I'll favor maintainability before compatibility.


--- Quote from: jcmontherock on June 15, 2022, 04:23:43 pm ---However, for example, you can use "System.Delete()" to execute a procedure if you already have a "Delete()" procedure in your application. It's a little namespace.

--- End quote ---

It's the “namespace” provided by the System unit which is automatically used in every unit that isn't the System unit.


--- Quote from: MarkMLl on June 16, 2022, 09:55:38 am ---I'd suggest that any departure from this which breaks compatibility with older FPC versions would be a very bad idea.

If we had to vote between keeping FPC compatible with both itself and older versions of Delphi, versus breaking compatibility in the name of chasing enhancements added to Delphi in its dotage, I'd be firmly on the side of tradition.

--- End quote ---

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.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version