[Lazarus] Support for dotted unit name
DrDiettrich1 at aol.com
Fri Nov 4 11:15:43 CET 2011
William Oliveira Ferreira schrieb:
> Sorry about my low knowlegde, maybe i am the most slow-learning mailer
> of this list but i don't understand the advantage of using dots on
> unit name. Could someon explain it to me?
It's not an advantage, only a relict from the (never finished) .NET
experiment. It's kind of emulation of the .NET namespaces or assemblies,
where e.g. System.System could denote the Delphi System unit in the .NET
namespace (or assembly) System.
As others already pointed out, dotted unit names can cause problems with
Delphi qualified names. Without dotted unit names "a.b.c"
(unit.object.method) is somewhat easy to parse, since only "a" has to be
searched in the used units list. But with dotted names the search also
must try to match "a.b" (or more) with a unit name. You may get wrong
results, when unit "a" contains a record or object variable "b" with
field "c", and a variable "a" in some other unit refers to an record (or
object) with fields "b.c".
There exist more relicts from .NET, like Unicode names for identifiers.
Since Delphi identifiers are case insensitive, the lookup of an
identifier then can be quite time consuming. While with ASCII names only
the "capital" bit must be cleared for all characters, in order to make
an identifier name unique (all uppercase), no such simple mapping exists
for non-ASCII characters. In C or C# all identifiers are case-sensitive,
so that no ToUpper or ToLower are required before the lookup of an
identifier, and consequently it doesn't matter whether an identifier
contains strange characters. IMO it were better to make Delphi
identifier names case sensitive at the same time, at least when they
contain non-ASCII characters.
More information about the Lazarus