[Lazarus] Support for dotted unit name
nc-gaertnma at netcologne.de
Fri Nov 4 14:49:05 CET 2011
"Christian-W. Budde" <Christian at savioursofsoul.de> hat am 4. November 2011 um
> > This is the explanation for using unitname.identifier, which worked
> > since many years.
> > Dotted unit name means dots in the unit name itself. For example
> > an.example.pas. I don't know a good example.
> For me, this makes perfect sense, because of many reasons. Here are a
> I work on several open source projects, which have in common that all
> these projects are marked with the abbreviation before the actual unit
> name. For example with Graphics32 it is 'GR32_'. Replacing the
> underscore with a '.' would make it appear more logical from a pascal
> point of view (underscores shall be avoided in favor of CamelCase) and
> the handling of units look more like records then.
> In my second project I have another example where it makes sense from a
> hierarchical point of view. There I have implemented dozens of filters,
> with lots of optimizations resulting in a vast amount of code. When I
> wanted to split this code into several units I thought, that it should
> have the name Filters first. But, to give an example, this would result
> in 'FiltersButterworth', 'FiltersChebyshev' and 'FiltersBasic'. It just
> seems to be odd in the english language, where it would rather be
> 'ButterworthFilters', 'ChebyshevFilters' and so on.
> Separating the names by something like a '.' would make much sense in my
If I understand you correct: it looks nicer.
Dotted unit names gives no technical advantage. It does not even allow to write
much shorter code like the recent enumerators.
About "more pascal":
The dotted unit names break the pascal rule that the last scope wins. For
example "uses unita.unitb, unita;" makes no sense, because the namespace unita
hides the unit unita, even though the unit comes after the namespace.
I doubt that this namespace concept makes Delphi/ObjectPascal easier to
learn/use. At the moment I guess the opposite is true. Has someone experience
with namespaces and newbies?
> I have never used .NET, nor am I a Delphi fan-boy, but I think this
> scoping is useful and I hope it will be supported by FPC. It is
> discussable, whether it shall be used in Lazarus, but it should be
It is supported by FPC and I implemented a few things in the IDE. "Find
declaration" does not yet support it.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Lazarus