[Lazarus] Namespace

Marcos Douglas md at delfire.net
Sun Jan 9 21:25:36 CET 2011


On Sun, Jan 9, 2011 at 2:57 PM, Andrew Brunner
<andrew.t.brunner at 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 = 'VAL1';
>  VALUE2 = 'Val2';
>  VALUE3 = 3;
> end;
>
> 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.  Even If in the interim,
> NameSpace:=Class ;-) somewhere... But to do it right there should be
> differences between classes and NameSpaces inside units.  Whats even
> more impressive is the fact that this could be coupled with
> abstraction
>
> But back on direct topic, I often use unit names to specify which
> method I want explicitly accessed/used.  In my project, sockets,
> byeArrays mean different things depending on where you are in specific
> a context.  Having the option to clarify where the item is typed was
> offered way back in Delphi days.

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
example,  xyz.TEdit ("xyz" would be the company, whatever) in all
declarations? Wouldn't more readable? And will have less conflicts
with others names of class too. Procedures and Functions, the same:
xyz.foo() not xyzFoo() how the most developers like to do.

Marcos Douglas




More information about the Lazarus mailing list