Re: Confused about units

alanglloyd_at_aol.com
Date: 02/15/05


Date: 15 Feb 2005 12:55:17 -0800


Maarten Wiltink wrote:
> "Matthew" <matthew@nospamhere.com> wrote in message
> news:api41192hd89tgiakl86kq09lj5e0rvcit@4ax.com...
>
<snip>
>
> Groetjes,
> Maarten Wiltink

I echo Maarten's approbation - good finding.

To clarify the relationship of "interface", "implementation" and
"uses".

The interface section contains items which any outside unit can see in
this unit (provided this unit is in the outside unit's uses clause).
Outside units however cannot see into the implementation section of
this unit.

The interface uses clause contains units in which any item in this unit
(both in the interface and implementation sections) can see the
interface section in an outside unit.

The implementation uses clause contains units in which the
implementation's items in this unit can see the outside unit's
interface clause.

If both interface uses clause contain the other's unit name then a
"circular reference error" ensues (as you found).

In general I put any of my other units that this unit's items has to
see, in the implementation uses clause, unless those items in this unit
are in the interface section of this unit. Then the other unit has to
go in the interface uses clause of this unit.

You may find this cannot work because items in both unit's interface
section have to see the other unit. Then those cross-referring items
will have to be moved to the same unit where they can see each other.

Note however that Delphi's units placed by Delphi in the interface uses
clause should not normally be moved to the implementation uses clause.

Alan Lloyd
alanglloyd@aol.com



Relevant Pages

  • Re: Opinions on approach, please...
    ... Write the where clause manually, ... MOST interface, with the original COBOL ISAM access commented out above it. ... I can certainly do it with dynamic SQL and MOST can build a WHERE statement ... application is doing lengthy sequential processing, how often, in what ...
    (comp.lang.cobol)
  • Re: Uses clause tool
    ... Arrange implementation uses clause to have one unit at a line. ... I have a tool to remove unused units, and move units to the implementation section. ... Note that Delphi will insist on having units appear in the interface section that aren't actually required for compilation. ... The tool will not sort units or do any kind of special formatting. ...
    (borland.public.delphi.thirdpartytools.general)
  • C# 3.0: no additions to where clause? dang.
    ... I was hoping for increased functionality with the where clause in C# ... Using the new keyword 'var' would really allow us to take nice ... interface MyFunc, interface operator+=, interface get ... I want to AND/OR the conditions for the where clause together. ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: Tool to detect unused units
    ... This is the case with the uses clause in the project file. ... entries from the unit and forms list of the IDE ... To assure that all class definitions needed for the streaming support ... of the interface part of a unit containing a form or data module ...
    (borland.public.delphi.thirdpartytools.general)
  • Re: memo and setting cursor on last position
    ... Maarten Wiltink schrieb: ... This isn't a command line interface by any chance, ... My problem is that when the user klicks somewhere in the input memo field and insert a word in the middle, the complete encoded text is unusable. ...
    (alt.comp.lang.borland-delphi)