[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Gm2] Re: ISO M2 CAST faulty behaviour and more about opaque types
From: |
Gaius Mulley |
Subject: |
[Gm2] Re: ISO M2 CAST faulty behaviour and more about opaque types |
Date: |
12 May 2005 13:12:47 +0100 |
User-agent: |
Gnus/5.09 (Gnus v5.9.0) Emacs/21.2 |
Iztok writes:
> Gaius !
>
> TYPE Foo = RECORD .... END;
> pFoo = POINTER TO Foo;
> VAR a : SYSTEM.ADDRESS;
> pfoo : pFoo;
>
> BEGIN
> pfoo := SYSTEM.CAST(pFoo, a); (* fails with "arguments to CAST must
> be (Type, Variable or Constant)" *)
> END
>
>
> One more thing:
>
> We have been discussing about opaque types recently and I have noticed
> the questionable implementation of the opaue types. Namely, you have
> said that you equaled them to SYSTEM.ADDRESS. I am concerned about
> the correct type checking now. Consider situation:
>
> DEFINITION 1
>
> TYPE Opaque1;
>
> IMPLEMENTATION 1
>
> TYPE OpaqueImpl1 = RECORD ..... END;
> TYPE Opaque1 = POINTER TO OpaqueImpl1;
>
> PROCEDURE p1 (arg1 : Opaque1);
>
> DEFINITION 2
>
> TYPE Opaque2;
>
> IMPLEMENTATION 2
>
> TYPE OpaqueImpl2 = RECORD ..... END;
> TYPE Opaque2 = POINTER TO OpaqueImpl2;
>
> PROCEDURE p2 (arg2 : Opaque2);
>
>
> MODULE 3
>
> VAR foo1 : 1.Opaque1;
> foo2 : 2.Opaque.2;
>
>
> You allow: foo1 := foo2 which could be correct considering their
> primary behaviour - being references. Considering their referenced
> type it should issue at least warning because you could by this logic
> do also :
>
> 2.p2( foo1 )
>
> which is dangerous.
>
> I think that the variable of typed pointer could be mutually
> assignable with another of SYSTEM.ADDRESS but not with another of
> different typed pointer, except using SYSTEM.CAST which transfers the
> reponsibility for functional disasters from compiler to developer in
> charge.
>
> It also means that opaque types can not be equalized to SYSTEM.ADDRESS
> but considered as typed pointers of different kinds
>
>
> It is not fatal but needs consideration.
>
> Anybody else with an opinion ?
Hi Iztok,
I believe these bugs have all been fixed,
[apologies if I've emailed this before, I'll scanning back through the
bug reports]
regards,
Gaius
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Gm2] Re: ISO M2 CAST faulty behaviour and more about opaque types,
Gaius Mulley <=