Re: [fpc-pascal] Re: Ideas for namespace implementation

2010-07-26 Thread Marcos Douglas
On Mon, Jul 26, 2010 at 11:47 AM, Martin wrote: > On 26/07/2010 15:36, Marcos Douglas wrote: >> [snip] >> >> {$NAMESPACE ON} >> unit strutils namespace my; >> >> With {$NAMESPACE ON} all units will have namespaces, unless FPC's units. >> > > Not sure why a directive? > > To allow none fully qualif

Re: [fpc-pascal] Re: Ideas for namespace implementation

2010-07-26 Thread Jonas Maebe
Hi everyone, Could you please move this thread to the fpc-devel list? Thanks, Jonas FPC mailing lists admin ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/mailman/listinfo/fpc-pascal

Re: [fpc-pascal] Re: Ideas for namespace implementation

2010-07-26 Thread Martin
On 26/07/2010 15:36, Marcos Douglas wrote: On Mon, Jul 26, 2010 at 11:20 AM, Sven Barth wrote: What about that the compiler enforces that you use the fully qualified name if you used it in the uses? Not only if you used it in the uses clause, but if you COMPILED with namespace sinta

Re: [fpc-pascal] Re: Ideas for namespace implementation

2010-07-26 Thread Graeme Geldenhuys
Op 2010-07-26 16:10, Sven Barth het geskryf: > > Are you sure that "_" is not allowed at the beginning of a unit name? > Compiles without problems. I wasn't. Thanks for confirming. So indeed the ugly _ syntax can't be used. I quite like Marcos Douglas's idea of using a colon between the namespac

Re: [fpc-pascal] Re: Ideas for namespace implementation

2010-07-26 Thread Graeme Geldenhuys
Op 2010-07-26 16:23, Marcos Douglas het geskryf: >> >> Hmm... "~" looks ugly :P > > IMHO, is better to use the ':' like myspace:sysutils That does indeed look better. Regards, - Graeme - ___ fpc-pascal maillist - fpc-pascal@lists.freepascal.or

Re: [fpc-pascal] Re: Ideas for namespace implementation

2010-07-26 Thread Marcos Douglas
On Mon, Jul 26, 2010 at 11:33 AM, Reimar Grabowski wrote: > On Mon, 26 Jul 2010 11:23:31 -0300 > Marcos Douglas wrote: > >> IMHO, is better to use the ':' like  myspace:sysutils > > Even better C++ style: > > uses >  myspace::sysutils; > > begin >  Exception; // no error >  SysUtils.Exception; //

Re: [fpc-pascal] Re: Ideas for namespace implementation

2010-07-26 Thread Marcos Douglas
On Mon, Jul 26, 2010 at 11:20 AM, Sven Barth wrote: > > What about that the compiler enforces that you use the fully qualified name > if you used it in the uses? Not only if you used it in the uses clause, but if you COMPILED with namespace sintaxe (eg. by Graeme unit strutils namespace my), IMHO

Re: [fpc-pascal] Re: Ideas for namespace implementation

2010-07-26 Thread Reimar Grabowski
On Mon, 26 Jul 2010 11:23:31 -0300 Marcos Douglas wrote: > IMHO, is better to use the ':' like myspace:sysutils Even better C++ style: uses myspace::sysutils; begin Exception; // no error SysUtils.Exception; // identifier not found MySpace::SysUtils.Exception; // no error end. R. -

Re: [fpc-pascal] Re: Ideas for namespace implementation

2010-07-26 Thread Marcos Douglas
On Mon, Jul 26, 2010 at 11:20 AM, Sven Barth wrote: > Hi! > > On 26.07.2010 16:06, Martin wrote: But worst of all uses sysutils; // the one from my project? >>> >>> No, because the RTL is not compiled with a namespace, so falls under the >>> "global" namespace with takes preference

Re: [fpc-pascal] Re: Ideas for namespace implementation

2010-07-26 Thread Sven Barth
Hi! On 26.07.2010 16:06, Martin wrote: But worst of all uses sysutils; // the one from my project? No, because the RTL is not compiled with a namespace, so falls under the "global" namespace with takes preference over project units or all other namespaces. This then stays consistent with how de

Re: [fpc-pascal] Re: Ideas for namespace implementation

2010-07-26 Thread Sven Barth
Hi! On 26.07.2010 15:44, Graeme Geldenhuys wrote: uses rc.foo, my.foo, my; // there is a unit my ... begin foo.a; // error, which foo? my.foo.a; // is that unit my, record foo.a OR unit my.foo ? Good point, I haven't thought that far. I only worked though of the uses clause. Maybe whe

Re: [fpc-pascal] Re: Ideas for namespace implementation

2010-07-26 Thread Martin
On 26/07/2010 14:44, Graeme Geldenhuys wrote: Please note: I did not say my ideas are perfect, just that they are suggestions that was put out there. Discussions regarding namespaces and ideas/suggestions need to filter out the finer details of what could or couldn't work. This is the whole point

Re: [fpc-pascal] Re: Ideas for namespace implementation

2010-07-26 Thread Graeme Geldenhuys
Op 2010-07-26 14:34, Martin het geskryf: > Let me see, if I got the idea (Graeme's idea) correct. Please note: I did not say my ideas are perfect, just that they are suggestions that was put out there. Discussions regarding namespaces and ideas/suggestions need to filter out the finer details of w

Re: [fpc-pascal] Re: Ideas for namespace implementation

2010-07-26 Thread Martin
On 25/07/2010 22:53, Graeme Geldenhuys wrote: On 25 July 2010 23:30, Michael Van Canneyt wrote: The discussion is not about namespaces. Object Pascal HAS namespaces, namely units. The discussion is about 'enhancing' the namespace to allow one or more dots in the name. With the importa

Re: [fpc-pascal] Re: Ideas for namespace implementation

2010-07-26 Thread Graeme Geldenhuys
Op 2010-07-26 11:34, Michael Van Canneyt het geskryf: > > Well, I fail to see what is more logical in my.constants than in myconstants. > The unit is still called my.constants, not constants. So you'll end up > typing my.constants everywhere anyway. The gain of this over myconstants is > highly de

Re: [fpc-pascal] Re: Ideas for namespace implementation

2010-07-26 Thread Michael Van Canneyt
On Sun, 25 Jul 2010, Graeme Geldenhuys wrote: On 25 July 2010 23:30, Michael Van Canneyt wrote: The discussion is not about namespaces. Object Pascal HAS namespaces, namely units. The discussion is about 'enhancing' the namespace to allow one or more dots in the name. With the importance t

Re: [fpc-pascal] Re: Ideas for namespace implementation

2010-07-25 Thread Graeme Geldenhuys
On 25 July 2010 23:30, Michael Van Canneyt wrote: > > The discussion is not about namespaces. Object Pascal HAS namespaces, > namely units. The discussion is about 'enhancing' the namespace to allow one > or more dots in the name. With the importance that the '.' is only needed when resolving a co

Re: [fpc-pascal] Re: Ideas for namespace implementation

2010-07-25 Thread Michael Van Canneyt
On Sun, 25 Jul 2010, Graeme Geldenhuys wrote: On 25 July 2010 19:16, Michael Van Canneyt wrote: What unit name conflicts ? In 15 years that I work with Delphi and FPC, and I have use many many packages, I encountered exactly 1 conflict: Then you are extremely lucky. I have experience stack

[fpc-pascal] Re: Ideas for namespace implementation

2010-07-25 Thread Graeme Geldenhuys
On 25 July 2010 19:16, Michael Van Canneyt wrote: > > What unit name conflicts ? In 15 years that I work with Delphi and FPC, and > I have use many many packages, I encountered exactly 1 conflict: Then you are extremely lucky. I have experience stacks of unit name conflicts in my years of programm