[Lazarus] Support for dotted unit name

William Oliveira Ferreira bdexterholland at gmail.com
Fri Nov 4 01:17:00 CET 2011

Thanks, becames more clear to me!

2011/11/3, Rich Saunders <saunders.richard.p at gmail.com>:
> 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
> that.
> 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.
> --
> _______________________________________________
> Lazarus mailing list
> Lazarus at lists.lazarus.freepascal.org
> http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

William de Oliveira Ferreira
Bacharel em Sistemas de Informação

More information about the Lazarus mailing list