[Lazarus] Namespace

Andrew Brunner andrew.t.brunner at gmail.com
Mon Jan 10 21:00:36 CET 2011


> 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 to see
what other code might look like.  So far I'm pretty impressed with the
results.

The problem I'm having that is urgent is that Lazarus won't jump to
the methods.  I can see that if FPC changes nuances with nested
namepsaces someone shouldn't have to play catchup to make changes to
codetools.  But, these changes have been there for at least a while,
and I would like /svn/trunk/ to support them.

The problem namespaces solve for me is to enforce design organization
within the group.  This unit was selected because it is the foundation
unit that facilitates real-time applications and the methods and
unit's constants and even data structures' default values when
initialized are stored in the ns object.

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...).  The only way I could reproduce this effort was with
separate units.  With namespaces - I can organize differing structs
even classes within the same unit bypassing the circular reference
issue.

IMEO namespaces are something to get EXCITED about.  But that's
because the project I'm working on in this case is highly complex and
requires conscience isolation when mind wrapping... This way I can
immediately acquire engineering context and dive-in.  Otherwise I have
to sift through documentation and code and blah blah blah just to
figure out what prior creator was trying to do.  Conscience isolation
is what makes OOP so valuable to us non-binary life forms ;-)  We
actually need constructs as building blocks... such as namespaces that
help us organize thoughts and methods to perform duties and whatnot.




More information about the Lazarus mailing list