Re: [ooc-compiler] WITH statement and parametric types
Brought to you by:
mva
|
From: Michael v. A. <mic...@gm...> - 2005-07-03 14:50:38
|
On 6/26/05, vedmed <ve...@in...> wrote: > I declare parametric type, and want to redefine procedure "Equals": > [...] >=20 > But in this example "Equal" always return FALSE, because of WITH > statement can not recognize parameter "y" as value of type "Alp" or > "Gam". Expressions "WITH y: Alp DO" and "WITH y: Alp(Object.Object) DO" > also not works. So I can't see a way how to get access to field "val" of > parameter "y". I don't know it is bug of compiler or some logic problem. > I suppose that full check of type and all of him parameters is difficult > task for compiler and can slow down compiled programs, but I assume, > that in most cases will be enough only checks of base type. The current implementation cannot cope with types on the right hand side of a type test that include a type variable. It is fundamentally=20 flawed. Unfortunately I botched a test case half a year ago, or I would have known this earlier. I don't know a workaround, and there is no easy fix. I will have to think about this some more. -- mva |