gnash-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Gnash-dev] ACT module; white box testing and aspect templates


From: Eric Hughes
Subject: Re: [Gnash-dev] ACT module; white box testing and aspect templates
Date: Wed, 18 Jul 2007 09:23:37 -0600

Here's the explanatory reply.

At 08:17 AM 7/18/2007, strk wrote:
I don't get the template<class,class> syntax on line 122.

It's complicated.  The prior sentence may be an understatement.

A basic problem with getting an aspect class defined is the following tension:
- The owner class may not know the definition of the aspect at the point of definition, because the aspect must be able to change. - An owner class must have a full aspect class definition at its point of instantiation, because an instance of the aspect class is a member of the owner class. - The aspect class must have a full owner class definition at its point of instantiation, because it must be able to refer to the innards of the owner class.

This all boils down to a definition cycle of length two. (Self-reference is a cycle of length one.) There's an issue of infinite regress in definition that must be addressed. The solution, in this case, is to make the aspect parameter a template, where the final argument of said template must be instantiated with the owner class itself. Observe the specialization definition (around line 167 in my current copy):
        template< class T >
class Null_Aspect_1< T, ACT::Handle_Registry_Leader< T, Null_Aspect_1 > > This class defines the null aspect for class Handle_Registry_Leader (which, without an aspect, would be a template class with parameter T). The second parameter is a class, which class is the owner, instantiated with its template arguments, which include the null aspect.

Here's the magic. The use of Null_Aspect_1 in the specialization definition refers to the specialized class itself, not the non-specialized definition (which is in Aspect.hpp). Such a specialization creates a reference cycle of length two, just as required.

Eric






reply via email to

[Prev in Thread] Current Thread [Next in Thread]