From: Derek Wyatt Date: 2005-08-26T22:35:41+09:00 Subject: Re: Circular dependecy on classes -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 |>class Solder |>~ def can_upgrade_to |>~ [Knight] |>~ end |>end |> |>And your problems go away. You don't have to open it up later. If |>you want it private, you can simply make it private. | | | Doesn't solve the OP'S problem because it was about dependencies: | Knight has to be defined when it is used. David already mentioned this, but remember that when the method is defined, it doesn't matter that "Knight" has no meaning as at this point it's just method definition. On method _execution_ it had better resolve to something or you're going to get an error. But in the OP's case, this is a non-issue as the def and exec deliniation is well-defined. This is a ruby-ish (or loosley defined as a "scripting"-ish) type of situation as in compiled languages you'd need to forward define the relationship (which Java basically does behind the scenes) in the C++ idiom of defining it as a class before using it like this: class Knight; class Soldier { ~ Something that uses Knight }; class Knight : public Soldier { }; We just get a shortcut with Ruby. Others mentioned the equivalent of the above by giving the idea of re-opening the class later on, which is perfectly acceptable and follows the traditional C++ type of requirement for this situation. But if we can make it shorter and easier to read, then why not? I really love this language. :) Regs, D -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.4 (MingW32) iD4DBQFDDxqpwwHFeC88e2IRApBcAKCCis/xGoPSeRaCsn3M4zZ0sBo+bACXfTT7 /+zUFdky71yerDjDFB5YTw== =k0sK -----END PGP SIGNATURE-----