Difference between revisions of "Multiple constraints"

 
Line 27: Line 27:
 
The semantic given to the code above is, that an actual parameter passed for G must be conform to both classes: B and C.
 
The semantic given to the code above is, that an actual parameter passed for G must be conform to both classes: B and C.
  
The standard defines in section 8.12.23 what the basic type of such a multiple constraint formal generic is. However, this definition can only be used to clearly define the set of available features to G and not the semantic of a qualified feature call like f.a.
+
The standard defines in section 8.12.23 what the basic type of such a multiple constraint formal generic is. However, this definition can only be used to clearly define the set of available features to G. It can not be used to define the semantic of a qualified feature call (like f.a) because the [http://eiffelsoftware.origo.ethz.ch/index.php/Transposition#The_new_dynamic_binding_semantics new semantics of dynamic binding] require an existing basic type which is then used as the static type for the call.
 +
 
 +
So the question the ECMA Standard does not answer is: What is the static type of a formal generic which has multiple constraints?

Revision as of 13:00, 30 October 2006

Description

New multiple constraints for generic parameters

With the new ECMA standard for Eiffel multiple constraints for generic parameters were introduced.

class GENERIC_CLASS [G -> {B, C }]
 
feature
   f: G
 
   example is
         -- issue
      do
            -- Qualified feature call
         f.a
      end
 
end

The semantic given to the code above is, that an actual parameter passed for G must be conform to both classes: B and C.

The standard defines in section 8.12.23 what the basic type of such a multiple constraint formal generic is. However, this definition can only be used to clearly define the set of available features to G. It can not be used to define the semantic of a qualified feature call (like f.a) because the new semantics of dynamic binding require an existing basic type which is then used as the static type for the call.

So the question the ECMA Standard does not answer is: What is the static type of a formal generic which has multiple constraints?