Results 1 to 5 of 5

Thread: recursive units?

  1. #1

    recursive units?

    For an component i am writing i ran into the following situation:

    tclass in uclass.pas is depend on:
    tclasslist in uclasslist.pas but that also needs tclass1 as
    tclasslist is an list of tclass and
    tclass contains an tclasslist.

    Now turbo delphi for win32 hapily takes this and it works, but i believe in previous versions of delphi this may not work as you would get an circular reference. Should i worry about this?
    http://3das.noeska.com - create adventure games without programming

  2. #2

    recursive units?

    You will only get circular referencing if everythiing appears in your interface section. If they are correctly set up in interface and implementation sections, I think you should be fine.

    Does this make sense?
    <br /><br />There are a lot of people who are dead while they are still alive. I want to be alive until the day I die.<br />-= Paulo Coelho =-

  3. #3

    recursive units?

    Im not sure myself, but i have delphi 2006 and used to 2005 and i know that they hated circular references unit1.pas uses unit2.pas, unit2.pas uses unit3.pas, and unit3.pas uses unit1.pas always broke down..
    M109uk
    <br />--------------------------------------------------------
    <br />www.pulse-soft.oneuk.com

  4. #4

    recursive units?

    Quote Originally Posted by savage
    You will only get circular referencing if everythiing appears in your interface section. If they are correctly set up in interface and implementation sections, I think you should be fine.

    Does this make sense?
    yes.

    my mistake in writing the tclass contains an tclasslist part as i did not have it i have a:
    FParent := TSkeleton(owner).GetBoneByName(FParentName);
    and the uses for that was in the implementation. Lucky me.

    The situation from my initial post can only be solved by putting both classes in the same unit then? As to declare tclasslist in tclass i need to have the second unit in the interface of the first an for tclass in tclasslist i need to have the first unit in the interface part.
    http://3das.noeska.com - create adventure games without programming

  5. #5

    recursive units?

    I'm not sure whether this topic is still relevant or not.
    But just to clear it up:

    Yes it does make sense where you put your uses.
    Example:

    You got unit1, which uses unit2.
    Put unit2 under your interface uses claw.
    Unit 2 also uses unit1 (for example for the form), put unit2 under your implementation uses claw.
    &quot;What we cannot speak about we must pass over in silence.&quot;

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •