[Lazarus] array[0..n] of class of TSomething

Mark Morgan Lloyd markMLl.lazarus at telemetry.co.uk
Wed Jul 13 11:51:24 CEST 2011


Hans-Peter Diettrich wrote:
> Flávio Etrusco schrieb:
> 
>> Err, why pollute the namespace with an identifier you'll only refer
>> once?
> 
> For clarity? Code is not only written for the compiler, but also for 
> human readers.

As are comments. Particularly for a rarely-used construct like 'class 
of' I think it's reasonable to split it out and say why it's there.

(* An element is either a scalar or a column in a (row in a) table, and 
is      *)
(* directly associated with the action of getting or setting a value via 
SNMP.  *)

type    CNodeContent= class of TNodeContent;

         TNodeContentArray= array of CNodeContent;

         CNode= class of TNode;

         TNodeArray= array of CNode;

         TNodeContent= class(TObject)
                       public

Also (as shown above) there's the potential for forward references, in 
which case I suggest it's good practice to be consistent.

-- 
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]




More information about the Lazarus mailing list