New CAT call: Difference between revisions

From EiffelStudio: an EiffelSoftware project
Jump to navigation Jump to search
Konradm (talk | contribs)
Konradm (talk | contribs)
Line 9: Line 9:
feature
feature
   f (a: ANY) do end
   f (a: ANY) do end
end
</code>
</code>
|
|
<code>[eiffel, n]
<code>[eiffel, n]
class B
class B
inherit A redefine f end
feature
feature
   f (a: STRING) do end  -- not valid
   f (a: STRING) do end  -- not valid
end
</code>
</code>
|
|
<code>[eiffel, n]
<code>[eiffel, n]
class B
class B
inherit A redefine f end
feature
feature
   f (a: ?STRING) do end  -- valid
   f (a: ?STRING) do end  -- valid
end
</code>
</code>
|}
|}

Revision as of 20:12, 27 October 2006

Introcution

The ECMA standard introduces a new solution to the CAT call problem. Covariant redefinition of a formal argument is only possible to an detatchable type:

class A
feature
   f (a: ANY) do end
end
class B
inherit A redefine f end
feature
   f (a: STRING) do end   -- not valid
end
class B
inherit A redefine f end
feature
   f (a: ?STRING) do end   -- valid
end