I am trying hard to think of a situation where unit prefixes are not enough, but its hard to see.
2012/8/21 Timothy Madden <terminato...@gmail.com>: > On 08/21/2012 02:17 PM, DaWorm wrote: >> Very tedious, but you could create a wrapper unit and/or class for each >> library, and expose a prefixed name instead of the original. > > Very ingeniuos, I believe this is as close to a solution as I can get > for now. > > But there are still a few probles I can see: > - there is no way to "prefix" symbols within a unit, that I know of. > Symbols may only be prefixed by the unit name directly. Is there a > sort of a "namespace" in Pascal ? > - if I make a wrapper unit around the third-party one, there is > alredy little need for a prefix, since I can expose only the > symbols I know of and that I use. > - I find it even more tedious to do the same thing with the System > unit or the standard Pascal units. > > And then, if wrapper unit publicly uses the third-party unit, doesn't > that mean that all symbols in the thrid-party unit are now automatically > exposed and public in the wrapper unit ? Nope, you can "uses" in the implementation section AND if a unit uses a third unit, the third unit identifiers are not visible in the program.. Unit a: Interface Uses b; Implementation End. Unit b; Interface Type z=integer; implementation end. program c; uses a; var h: z; begin end. Type Z is not visible in program c, generating an error. > > If so, is there a way to expose and make public the types, classes, > variables and functions from a private (implementation) unit ? > > Thank you, > Timothy Madden > > > _______________________________________________ > fpc-pascal maillist - fpc-pascal@lists.freepascal.org > http://lists.freepascal.org/mailman/listinfo/fpc-pascal Types, consts, variables, classes, functions, procedures etc, are public if they are defined in the interface section, and private if they are defined in the implementation section. A unit/program imports the interface definitions of another unit if it uses then in their own interface section. _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal