Language hole or wrong implementation? 
Author Message
 Language hole or wrong implementation?

This is a multi-part message in MIME format.
--------------AF7CE2E127CCC262C8FFD8EE
Content-Type: multipart/alternative; boundary="------------5D528DFDB9DC04CA8004813B"

--------------5D528DFDB9DC04CA8004813B
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Question,

Is the following valid Eiffel code?  It compiles and executes (with
unexpected results) in Visual Eiffel 2.0.

Synopsis: -----------
  "Eiffel: The Language" says that given a generic class G, G[A]
conforms to G[B], as long as A is an ancestor of B.  Assuming the above
is true, how does the language safeguard against the following:
  0) Assume:
        - B derives from A
        - generic class G[T] has method 'setAttr(val:T)',
        - class U has methods 'make' and 'test(g : G[A])'
  1) Method 'make' of class U creates an instance, named g, of G[B],
  2) and then it calls 'test ( g )',
  3) Method 'test( g: G[A] )' creates an instance of A, named a, and
then calls 'g.setAttr(a)'

   In the above scenario, we have called 'setAttr ( val : B )' with a
non-conforming argument (i.e. of type A).
-----------------

The source files that compile and run in Visual Eiffel are attached.

--------------5D528DFDB9DC04CA8004813B
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit

<HTML>
<HEAD>
<!-- selection start -->
</HEAD>
Question,

<P>Is the following valid Eiffel code?&nbsp; It compiles and executes (with
unexpected results) in Visual Eiffel 2.0.

<P>Synopsis: -----------
<BR>&nbsp; "Eiffel: The Language" says that given a generic class G, G[A]
conforms to G[B], as long as A is an ancestor of B.&nbsp; Assuming the
above is true, how does the language safeguard against the following:
<BR>&nbsp; 0) Assume:
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - B derives from A
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - generic class G[T] has
method 'setAttr(val:T)',
<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; - class U has methods 'make'
and 'test(g : G[A])'
<BR>&nbsp; 1) Method 'make' of class U creates an instance, named g, of
G[B],
<BR>&nbsp; 2) and then it calls 'test ( g )',
<BR>&nbsp; 3) Method 'test( g: G[A] )' creates an instance of A, named
a, and then calls 'g.setAttr(a)'

<P>&nbsp;&nbsp; In the above scenario, we have called 'setAttr ( val :
B )' with a non-conforming argument (i.e. of type A).
<BR>-----------------

<P>The source files that compile and run in Visual Eiffel are attached.</HTML>

--------------5D528DFDB9DC04CA8004813B--

--------------AF7CE2E127CCC262C8FFD8EE
Content-Type: application/x-unknown-content-type-EiffelText; name="main.e"
Content-Transfer-Encoding: base64
Content-Disposition: inline; filename="main.e"

Y2xhc3MgTUFJTg0KY3JlYXRpb24NCiAgIG1ha2UNCmZlYXR1cmUge0FOWX0NCiAgIG1ha2Ug
aXMNCiAgICAgIGxvY2FsDQogICAgICAgICBnIDogR0VOW0RFUklWRURfQVRUUl0NCiAgICAg
ICAgIGIgOiBCQVNFX0FUVFINCiAgICAgICAgIGQgOiBERVJJVkVEX0FUVFINCiAgICAgIGRv
DQogICAgICAgICAhIWcNCiAgICAgICAgIA0KICAgICAgICAgLS0gISFiDQogICAgICAgICAt
LSBnLnNldEF0dHIgKCBiICkNCiAgICAgICAgIC0tLS0gVGhlIGFib3ZlIGxpbmUgd291bGQg
Z2VuZXJhdGUgZXJyb3I6IEJBU0VfQVRUUiBkb2VzIG5vdCBjb25mb3JtIHRvIERFUklWRURf
QVRUUg0KICAgICAgICAgDQogICAgICAgICB0cnlfdG9fYnJlYWsgKCBnICkNCiAgICAgICAg
IGQgOj0gZy5hdHRyICAgICAgLS0gVGhlIHJlYWwgdHlwZSBvZiBnLmF0dHIgaXMgQkFTRV9B
VFRSLCBub3QgREVSSVZFRF9BVFRSIGFzIHlvdSB3b3VsZCBleHBlY3QhICAgICAgICANCiAg
ICAgICAgIGQuc3BlYWs7ICAgICAgICAgLS0gVGhlIG1lc3NhZ2UgIkknbSBCQVNFX0FUVFIh
IiB3b3VsZCBiZSBwcmludGVkISANCiAgICAgIGVuZCAtLSBtYWtlDQogICANCiAgIHRyeV90
b19icmVhayAoIGcgOiBHRU5bQkFTRV9BVFRSXSApIGlzDQogICAgICBsb2NhbA0KICAgICAg
ICAgYiA6IEJBU0VfQVRUUiANCiAgICAgIGRvDQogICAgICAgICAhIWINCiAgICAgICAgIGcu
c2V0QXR0ciAoIGIgKSAgIC0tIE5vIGVycm9yIHdpbGwgYmUgZ2VuZXJhdGVkIGF0IHJ1bi10
aW1lIQ0KICAgICAgICAgLS0gZy5zZXRBdHRyQ3luaWNhbCAoIGIgKQ0KICAgICAgICAgLS0t
LSBUaGUgYWJvdmUgY2FsbCB3b3VsZCBnZW5lcmF0ZSBhbiBlcnJvciBtZXNzYWdlIGFuIHJ1
bi10aW1lLg0KICAgICAgZW5kDQogICAgICAgICANCmVuZCAtLSBNQUlODQo=
--------------AF7CE2E127CCC262C8FFD8EE
Content-Type: application/x-unknown-content-type-EiffelText; name="gen.e"
Content-Transfer-Encoding: base64
Content-Disposition: inline; filename="gen.e"

Y2xhc3MgR0VOW1QgLT4gQkFTRV9BVFRSXQ0KZmVhdHVyZSB7QU5ZfQ0KICAgYXR0ciA6IFQ7
DQogICANCiAgIHNldEF0dHJDeW5pY2FsICggdmFsIDogVCApIGlzDQogICAgICByZXF1aXJl
DQogICAgICAgICB2YWwgLz0gVm9pZA0KICAgICAgZG8NCiAgICAgICAgIGF0dHIgPz0gdmFs
DQogICAgICAgICBpZiAoIGF0dHIgPSBWb2lkICkgdGhlbg0KICAgICAgICAgICAgaW8ucHV0
X3N0cmluZyAoICJFcnJvcjogQmFkIGFyZ3VtZW50IHBhc3NlZCB0byBCQVNFX0FUVFI6OnNl
dEF0dHJDeW5pY2FsKCkhIiApDQogICAgICAgICAgICBpby5wdXRfbmV3X2xpbmUNCiAgICAg
ICAgIGVuZA0KICAgICAgZW5kDQogICAgDQogICAgc2V0QXR0ciAoIHZhbCA6IFQgKSBpcw0K
ICAgICAgcmVxdWlyZQ0KICAgICAgICAgdmFsIC89IFZvaWQNCiAgICAgIGRvDQogICAgICAg
ICBhdHRyIDo9IHZhbA0KICAgICAgZW5kDQplbmQgLS0NCg==
--------------AF7CE2E127CCC262C8FFD8EE
Content-Type: application/x-unknown-content-type-EiffelText; name="base_attr.e"
Content-Transfer-Encoding: base64
Content-Disposition: inline; filename="base_attr.e"

Y2xhc3MgQkFTRV9BVFRSDQpmZWF0dXJlIHtBTll9DQogICBzcGVhayBpcw0KICAgICAgZG8N
CiAgICAgICAgIGlvLnB1dF9zdHJpbmcgKCAiSSdtIEJBU0VfQVRUUiEiICk7DQogICAgICAg
ICBpby5wdXRfbmV3X2xpbmU7DQogICAgICBlbmQNCmVuZCAtLQ0K
--------------AF7CE2E127CCC262C8FFD8EE
Content-Type: application/x-unknown-content-type-EiffelText; name="derived_attr.e"
Content-Transfer-Encoding: base64
Content-Disposition: inline; filename="derived_attr.e"

Y2xhc3MgREVSSVZFRF9BVFRSDQppbmhlcml0IEJBU0VfQVRUUiByZWRlZmluZSBzcGVhayBl
bmQNCmZlYXR1cmUge0FOWX0NCiAgIHNwZWFrIGlzDQogICAgICBkbw0KICAgICAgICAgaW8u
cHV0X3N0cmluZyAoICJJJ20gREVSSVZFRF9BVFRSISIgKTsNCiAgICAgICAgIGlvLnB1dF9u
ZXdfbGluZQ0KICAgICAgZW5kDQplbmQgLS0NCg==
--------------AF7CE2E127CCC262C8FFD8EE--



Thu, 18 Nov 1999 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. lambda trouble, wrong scheme implementation?

2. Wrong reasons to enhancing the language

3. Cheap implementations of languages (comp.lang.misc)

4. Language Implementation Survey

5. PC implementations of OO languages

6. FROTH, 386 32-bits implementation of forth language

7. Are there any FORTH implementations of computer languages?

8. implementations of computer languages?

9. Are there any FORTH implementations of computer languages

10. implementations of computer languages?

11. implementations of computer languages?

12. :logo implementations in languages other then english

 

 
Powered by phpBB® Forum Software