[Lazarus] Namespace

Andreas Schneider aksdb at gmx.de
Wed Jan 12 17:57:34 CET 2011


On 12.01.2011, 17:48 Marcos Douglas wrote:

> On Wed, Jan 12, 2011 at 1:18 PM, Alexander Klenin <klenin at gmail.com> wrote:
>> On Wed, Jan 12, 2011 at 21:09, Marcos Douglas <md at delfire.net> wrote:
>>> On Tue, Jan 11, 2011 at 6:03 PM, Hans-Peter Diettrich
>>> <DrDiettrich1 at 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 cases because I can't use the identifiers TEdit, TButton, etc.
>>> Then we always will have to invent prefixes for new widgets?
>>
>> If you invent a new button, then I guess naming it TButton
>> will be confusing regardless of chosen namespace, since
>> TButton is a well-known name for any Delphi/Lazarus developer.

> Yes, but this was just an example.
> Another example: A while ago I used the prefix "dx", but then I
> discovered that DevExpress.com already using this prefix.
> So, I really would not use TButton or TEdit... but if we want, we could not use?

> I think it's harder to have conflicts with the names of units (but
> they do happen) than with class names.

...  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  the  default  one  and  you  can still use your own TButton by
prefixing it with your own unitname. All you want is already there and
seems to cover 99% of the usecases.

--
Andreas Schneider 





More information about the Lazarus mailing list