Difference between revisions of "Conversion rules"

(Added category)
Line 1: Line 1:
 
[[Category:Compiler]]
 
[[Category:Compiler]]
 +
[[Category:ECMA]]
 
{{Warning|'''Warning''': Article under development}}
 
{{Warning|'''Warning''': Article under development}}
  

Revision as of 08:12, 19 January 2007

Warning.png Warning: Warning: Article under development

Introduction

This article discusses issues recently discovered for the following two validity rules:

8.15.7 Validity: Conversion Procedure rule, Validity code: VYCP
8.15.8 Validity: Conversion Query rule, Validity code: VYCQ

Examples

For the following examples eweasel tests have been created. Their named

Example 1

eweasel test: convert-to-current-type

class A[G]
convert
   to_a: {A[G]}
feature
   to_a: A[G]
end

The conversion to A[G] should indeed not be valid because they are conform.

The only rule that matters in our case is VYCQ(3).

What VYCQ(3) asks is the following

Is A[ANY] conform to A[G]?

As we answer this question clearly with no, the conversion is valid because all the other rules do not object either.

Example 2

eweasel test: convert-to-current-type

class A[G]
convert
   to_a: {A[STRING]}
feature
   to_a: A[STRING]
end

In the case where G's actual type parameter is a subtype of STRING the two types are conform again.

The interesting rule is again VYCQ(3):

Is A[ANY] conform to A[STRING]?

This question is answered with no too. Therefore the conversion is valid.