Re: [Lazarus] Namespace

2011-01-12 Thread Sven Barth
Am 11.01.2011 22:42, schrieb Hans-Peter Diettrich: Marcos Douglas schrieb: So if rxlib would take the namespace rx (on top of units), and someone else did also take that namespace, then you have the same problem You right... but, of course at Namespaces will be much longer than rx! The

Re: [Lazarus] Namespace

2011-01-12 Thread Alexander Klenin
On Wed, Jan 12, 2011 at 21:09, Marcos Douglas m...@delfire.net wrote: On Tue, Jan 11, 2011 at 6:03 PM, Hans-Peter Diettrich drdiettri...@aol.com wrote: Duplicate identifiers are used in the same unit in very rare cases only, so that normally a qualification is not necessary at all. Rare

Re: [Lazarus] Namespace

2011-01-12 Thread Marcos Douglas
On Wed, Jan 12, 2011 at 1:18 PM, Alexander Klenin kle...@gmail.com wrote: On Wed, Jan 12, 2011 at 21:09, Marcos Douglas m...@delfire.net wrote: On Tue, Jan 11, 2011 at 6:03 PM, Hans-Peter Diettrich drdiettri...@aol.com wrote: Duplicate identifiers are used in the same unit in very rare cases

Re: [Lazarus] Namespace

2011-01-12 Thread Andreas Schneider
On 12.01.2011, 17:48 Marcos Douglas wrote: On Wed, Jan 12, 2011 at 1:18 PM, Alexander Klenin kle...@gmail.com wrote: On Wed, Jan 12, 2011 at 21:09, Marcos Douglas m...@delfire.net wrote: On Tue, Jan 11, 2011 at 6:03 PM, Hans-Peter Diettrich drdiettri...@aol.com wrote: Duplicate identifiers

Re: [Lazarus] Namespace

2011-01-12 Thread Jürgen Hestermann
Marcos Douglas schrieb: And if we can rename, in the code, the names of the units then it would be perfect, IMHO. Like this: uses CompanyXYZ_StdCtrls as xyzctrls; That looks a bit like Modula to me. -- ___ Lazarus mailing list

Re: [Lazarus] Namespace

2011-01-12 Thread Marcos Douglas
On Wed, Jan 12, 2011 at 1:57 PM, Andreas Schneider ak...@gmx.de wrote: ...  which  you  can  already  do.  The  unit order in the uses clause already  determines  which  identifier  is  chosen  when  you do *not* specify  a  unit  explicitly.  So just make sure that LCL's TButton is always  

Re: [Lazarus] Namespace

2011-01-12 Thread Marcos Douglas
On Wed, Jan 12, 2011 at 1:59 PM, Jürgen Hestermann juergen.hesterm...@gmx.de wrote: Marcos Douglas schrieb: And if we can rename, in the code, the names of the units then it would be perfect, IMHO. Like this: uses  CompanyXYZ_StdCtrls as xyzctrls; That looks a bit like Modula to me.

Re: [Lazarus] Namespace

2011-01-12 Thread Hans-Peter Diettrich
Sven Barth schrieb: When namespaces correspond to unit names, i.e. disk files, a disambiguation is always possible by adding the parent directory to the unit name. This is not implemented, because there never existed an urgent need for such an extension, but it would always end up in unique

Re: [Lazarus] Namespace

2011-01-12 Thread Jürgen Hestermann
Marcos Douglas schrieb: And if we can rename, in the code, the names of the units then it would be perfect, IMHO. Like this: uses CompanyXYZ_StdCtrls as xyzctrls; That looks a bit like Modula to me. I do not know Modula. This is good, in Modula?!

Re: [Lazarus] Namespace

2011-01-12 Thread Mattias Gaertner
    Marcos Douglas m...@delfire.net hat am 12. Januar 2011 um 18:05 geschrieben: On Wed, Jan 12, 2011 at 1:57 PM, Andreas Schneider ak...@gmx.de wrote: ...  which  you  can  already  do.  The  unit order in the uses clause already  determines  which  identifier  is  chosen  when  you do

Re: [Lazarus] Namespace

2011-01-12 Thread Marcos Douglas
2011/1/12 Mattias Gaertner nc-gaert...@netcologne.de: But I can register a component called TButton? No, that would conflict with the LCL TButton. See the FCL function FindClass. I know. Because that I proposed the Lazarus put the unit name in the code, automatic... Just use the right

Re: [Lazarus] Namespace

2011-01-12 Thread Mattias Gaertner
On Wed, 12 Jan 2011 15:00:51 -0300 Marcos Douglas m...@delfire.net wrote: 2011/1/12 Mattias Gaertner nc-gaert...@netcologne.de: But I can register a component called TButton? No, that would conflict with the LCL TButton. See the FCL function FindClass. I know. Because that I

Re: [Lazarus] Namespace

2011-01-12 Thread Marcos Douglas
On Wed, Jan 12, 2011 at 3:26 PM, Mattias Gaertner nc-gaert...@netcologne.de wrote: On Wed, 12 Jan 2011 15:00:51 -0300 Marcos Douglas m...@delfire.net wrote: 2011/1/12 Mattias Gaertner nc-gaert...@netcologne.de: But I can register a component called TButton? No, that would conflict with

Re: [Lazarus] Namespace

2011-01-12 Thread Sven Barth
On 12.01.2011 18:24, Mattias Gaertner wrote: Marcos Douglas m...@delfire.net hat am 12. Januar 2011 um 18:05 geschrieben: On Wed, Jan 12, 2011 at 1:57 PM, Andreas Schneider ak...@gmx.de wrote: ... which you can already do. The unit order in the uses clause already determines which

Re: [Lazarus] Namespace

2011-01-12 Thread Marcos Douglas
On Wed, Jan 12, 2011 at 3:53 PM, Sven Barth pascaldra...@googlemail.com wrote: On 12.01.2011 18:24, Mattias Gaertner wrote: Marcos Douglas m...@delfire.net hat am 12. Januar 2011 um 18:05 geschrieben:   On Wed, Jan 12, 2011 at 1:57 PM, Andreas Schneider ak...@gmx.de wrote:     ... which

Re: [Lazarus] Namespace

2011-01-11 Thread Marco van de Voort
On Mon, Jan 10, 2011 at 04:57:43PM -0300, Marcos Douglas wrote: is still an option. Right! But you saw what I written in first mail of this thread? See: If units are namespaces, why not use them in widgets declarations, automatic, in Lazarus? Why would you? If the number of identifier

Re: [Lazarus] Namespace

2011-01-11 Thread Marcos Douglas
2011/1/10 Michael Van Canneyt mich...@freepascal.org: On Mon, 10 Jan 2011, Marcos Douglas wrote: On Mon, Jan 10, 2011 at 4:34 PM, Michael Van Canneyt mich...@freepascal.org wrote: The prefix is not needed. It makes it easier, but is by no means a requirement, as long as you keep the unit

Re: [Lazarus] Namespace

2011-01-11 Thread Marcos Douglas
On Tue, Jan 11, 2011 at 5:50 AM, Marco van de Voort mar...@stack.nl wrote: On Mon, Jan 10, 2011 at 04:57:43PM -0300, Marcos Douglas wrote: is still an option. Right! But you saw what I written in first mail of this thread? See: If units are namespaces, why not use them in widgets

Re: [Lazarus] Namespace

2011-01-11 Thread Hans-Peter Diettrich
Marcos Douglas schrieb: Working with items of the same name, from different locations (units, namespaces), requires qualifications all over. That waste of characters in source code makes code less readable to me. Waste of characters? Not really. Write xyz.TFoo is not so different of TxyzFoo.

Re: [Lazarus] Namespace

2011-01-11 Thread Hans-Peter Diettrich
Andrew Brunner schrieb: ns is where I plan to put my parent namespace. All other structs/consts/defaults/enums/ etc will be declared there and under children of ns (globals there and children have their own from that point on...). You can apply that to your unit names as well. With

Re: [Lazarus] Namespace

2011-01-10 Thread Marco van de Voort
On Sun, Jan 09, 2011 at 10:57:39AM -0600, Andrew Brunner wrote: NS_APP_FIELDS=NameSpace const VALUE1 = 'VAL1'; VALUE2 = 'Val2'; VALUE3 = 3; end; I recognize it doesn't change much, but it would sure look more industry standardized if this would work. While one can discuss if

Re: [Lazarus] Namespace

2011-01-10 Thread Sven Barth
Am 09.01.2011 19:56, schrieb Hans-Peter Diettrich: Why this? Well, we would not need to use prefixes in the names of our widgets. I could develop a widget called TEdit too, but using my own unit. All existing form objects are stored in Application.CustomForms[], and their controls in

Re: [Lazarus] Namespace

2011-01-10 Thread Marcos Douglas
On Sun, Jan 9, 2011 at 3:56 PM, Hans-Peter Diettrich drdiettri...@aol.com wrote: Marcos Douglas schrieb: If units are namespaces, why not use them in widgets declarations, automatic, in Lazarus? When we droped a widget in a Form, ie a TEdit, the declarion would be like this: TForm1 =

Re: [Lazarus] Namespace

2011-01-10 Thread Hans-Peter Diettrich
Marcos Douglas schrieb: I'm not talk about RTTI but style, make code more readable and less duplication of names. Working with items of the same name, from different locations (units, namespaces), requires qualifications all over. That waste of characters in source code makes code less

Re: [Lazarus] Namespace

2011-01-10 Thread Marcos Douglas
On Mon, Jan 10, 2011 at 9:43 AM, Hans-Peter Diettrich drdiettri...@aol.com wrote: Marcos Douglas schrieb: I'm not talk about RTTI but style, make code more readable and less duplication of names. Working with items of the same name, from different locations (units, namespaces), requires

Re: [Lazarus] Namespace

2011-01-10 Thread Martin
On 10/01/2011 18:51, Marcos Douglas wrote: Working with items of the same name, from different locations (units, namespaces), requires qualifications all over. That waste of characters in source code makes code less readable to me. Waste of characters? Not really. Write xyz.TFoo is not so

Re: [Lazarus] Namespace

2011-01-10 Thread Marcos Douglas
On Mon, Jan 10, 2011 at 4:34 PM, Michael Van Canneyt mich...@freepascal.org wrote: The prefix is not needed. It makes it easier, but is by no means a requirement, as long as you keep the unit names separate. Compare  Edit1 : myedit.tedit to  Edit1 : tmyedit In the second case, you'll

Re: [Lazarus] Namespace

2011-01-10 Thread Andrew Brunner
So namespaces: yes, nice to have. But do they solve an urgent problem ? I don't think so. Michael. I agree. I was using C# for a while and that's when I got used to the idea that I could group consts and methods not associated with objects. I have only one unit that HEAVILY uses namespaces

Re: [Lazarus] Namespace

2011-01-10 Thread Marcos Douglas
On Mon, Jan 10, 2011 at 4:48 PM, Martin laza...@mfriebe.de wrote: Ideas about namespaces have ben collected before http://wiki.lazarus.freepascal.org/Namespaces But in the end, iirc none of them solves the problem. They just move the problem to the next level. And speaking of

Re: [Lazarus] Namespace

2011-01-10 Thread Michael Van Canneyt
On Mon, 10 Jan 2011, Marcos Douglas wrote: On Mon, Jan 10, 2011 at 4:34 PM, Michael Van Canneyt mich...@freepascal.org wrote: The prefix is not needed. It makes it easier, but is by no means a requirement, as long as you keep the unit names separate. Compare  Edit1 : myedit.tedit to  

[Lazarus] Namespace

2011-01-09 Thread Marcos Douglas
If units are namespaces, why not use them in widgets declarations, automatic, in Lazarus? When we droped a widget in a Form, ie a TEdit, the declarion would be like this: TForm1 = class(Form) Edit1: StdCtrls.TEdit; end; Why this? Well, we would not need to use prefixes in the names of our

Re: [Lazarus] Namespace

2011-01-09 Thread Marcos Douglas
On Sun, Jan 9, 2011 at 2:57 PM, Andrew Brunner andrew.t.brun...@gmail.com wrote: I just started leveraging this fact in my project.  The complaint I bring is that I don't want to use a class object.  I want a dedicated NameSpace as a reserved word. ie.) NS_APP_FIELDS=class const  VALUE1 =

Re: [Lazarus] Namespace

2011-01-09 Thread Michael Fuchs
Am 09.01.2011 16:11, schrieb Marcos Douglas: If units are namespaces, why not use them in widgets declarations, automatic, in Lazarus? [...] All most developers use prefixes in yours classes and functions. Pascal not is C and don't need this. So, why do that? Maybe the unit names should be

Re: [Lazarus] Namespace

2011-01-09 Thread Andrew Brunner
On Sun, Jan 9, 2011 at 2:25 PM, Marcos Douglas m...@delfire.net wrote: And what about procedures/functions? This problem isn't just about classes... In C, all the indentifiers would be unique, but not in Pascal. We have units (namespace) so, why use prefixes like TxyzEdit? Why not use, for

Re: [Lazarus] Namespace

2011-01-09 Thread Hans-Peter Diettrich
Marcos Douglas schrieb: If units are namespaces, why not use them in widgets declarations, automatic, in Lazarus? When we droped a widget in a Form, ie a TEdit, the declarion would be like this: TForm1 = class(Form) Edit1: StdCtrls.TEdit; end; IMO control classes have to be registered, so