Mixin layers and cyclic dependencies
Steve Horne
stephenwantshornenospam100 at aol.com
Wed Sep 13 02:55:58 PDT 2006
On Tue, 12 Sep 2006 09:39:34 +0200, Don Clugston <dac at nospam.com.au>
wrote:
>I don't see how it could ever work. An alias contains the fully
>qualified name, with type information. You're asking it for a name where
>part of the name is the full name; this results in an infinitely long
>recursive name.
Depends how you represent the name. It's possible to have explicit
recursion. Generate UIDs for each instance, defining what they refer
to on the first reference. In principle, you could end up with a
mangled name something like...
0!A( 1!B( 0 ))
The second reference to UID '0' refers back to the first, using the
same template name and parameters. It's fairly easy to generate a form
like this from a symbol graph and visa versa, so it's fairly easy to
derive one mangled name from the other (eg determine the mangled name
of a templates parameter).
0!A( 1!B( 0 ))
Becomes...
+-+ ---> +-+
|A| |B|
+-+ <--- +-+
Becomes...
0!B( 1!A( 0 ))
The UIDs are generated from scratch in order of reference to ensure
that the names are generated consistently. Attempting to give each
instance a unique identifier that stays the same from build to build
would probably be very fragile.
So - possible, but it would probably need a new name mangling system.
That's bad - a compiler upgrade would invalidate all objs and libs,
and that can create problems esp. with third party libraries where you
don't have the source.
Also, since the mangleof thing is supplied by the compiler, people may
be dependent on it in strange ways. I wouldn't be surprised if people
have values in files that were derived somehow from mangled names.
Something serialization related, perhaps.
Definitely not something to be changed lightly.
--
Remove 'wants' and 'nospam' from e-mail.
More information about the Digitalmars-d
mailing list