We are using cookies to give you the best experience on our site. Cookies are files stored in your browser and are used by most websites to help personalise your web experience.
By continuing to use our website without changing the settings, you are agreeing to our use of cookies.


Continuation method

From The Concept-Oriented Portal
Jump to: navigation, search

A concept in the concept-oriented programming (COP) can be thought of as a space. This space has a border that has to be intersected by any access request leading to a subconcept. A concept normally wants to intercept access requests like method calls or messages passing through its border in order to carry out appropriate intermediate processing. For this purpose a concept may define a dual pair of special continuation methods which are called to intercept passing access requests.

The reference class continuation method is intended to resolve this reference into the substituted primitive reference. It allows us to get a direct reference from an indirect reference. The direct primitive reference can be then used to access the represented object. The idea is that the programmer defines an appropriate format of reference in the reference class and then writes the resolution procedure in its continuation method.

The following code shows an example of the reference continuation method:

   concept Account 
       reference {
           String accountNumber; // Identifier 
           void continue() { 
               print("> Account: Start resolution ");
               Object o = resolve(accountNumber); 
               o.continue(); 
               print("< Account: End resolution");
           } 
       }
       object {
         ...
       }

In this example the continuation method of the reference class prints two messages before it starts reference resolution and after it finishes the resolution. The resolution itself is implemented via method resolve() implemented somewhere in this or parent concept. Then it applies the continuation method to the just resolved primitive reference o: o.continue(). Since it is a primitive reference the compiler considers it a direct representation of the object and calls the next method in the sequence of access.

See also

External links

Personal tools
Google AdSense