Re: RECORD vs POINTER TO RECORD

From: Dominik Gruntz <"Dominik>
Date: Tue, 22 Aug 2000 22:12:07 +0200

> When I define
>
> Model = RECORD (Models.Model)
> etc
>
> instead of
>
> Model = POINTER TO RECORD (Models.Model)
> etc
>
> and then try to define the internalize/externalize etc
> PROCEDURE (VAR m: Model) Internalize- (VAR rd: Stores.Reader)X;
>
> I get the error message (at X) that the parameter doesn't match (there
> may be other errors as well in defining the Model this way)
that's correct. In Models.Model the receiver is defined as POINTER and
this parameter must not be changed if the method is overwritten in
an extension.

> I have tried to define the model as a record because the model contains
> linked lists (which I want to alter within methods) and cannot call a
> pointer by reference in the receiver of methods.
I do not quite understand why you want to declare Model as RECORD,
but if you really need that, define both a Record (ModelDesc) and a
pointer type (Model) and overwrite the inherited methods for the pointer
type.

 TYPE
  Model = POINTER TO ModelDesc;
  ModelDesc = RECORD (Models.Model) END;
  
 PROCEDURE (m: Model) Internalize (VAR rd: Stores.Reader);
 BEGIN
 END Internalize;
 
 PROCEDURE (VAR m: ModelDesc) Foo*, NEW;
 END Foo;
 
 
- Dominik


--------------------------------------------

To unsubscribe from this mailing list, send a message containing the word "unsubscribe" to:
   blackbox-request{([at]})nowhere.xy

To get a list of valid e-mail commands and instructions on their usage, send a message containing the word "help" to the above address.

Send any problem reports or questions related to this email list to the list owner at
   owner-blackbox{([at]})nowhere.xy
Received on Tue Aug 22 2000 - 20:12:07 UTC

This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:27:45 UTC