[Lazarus] Support for dotted unit name

Rich Saunders saunders.richard.p at gmail.com
Fri Nov 4 00:46:01 CET 2011

On 11/3/11 7:03 PM, William Oliveira Ferreira wrote:
> 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?

Say you use a bunch of units where XXX is defined multiple times, once
in each unit.

If you refer to XXX alone the actual XXX being referred to is determined
by the search logic of the compiler which is governed by the scope rules
within your unit and by the order of the uses clause. So arbitrary
changes in the unit ordering can change the semantics of your code.
But if you really want to be sure that UnitX.XXX is the XXX being
referenced you need to refer to XXX with the unit name prefix to ensure

This happens to me when I declare a method of a class as Inc to
increment some field value in the class. Within the Inc method I need to
call System.Inc to actually do the incrementing. Without the System
prefix I would get recursion since the Inc method would call itself.

Rich S.

More information about the Lazarus mailing list