- ReadStore

From: Douglas G. Danforth <"Douglas>
Date: Sat, 02 Sep 2006 17:08:10 -0400

----boundary-LibPST-iamunique-683337405_-_-
Content-type: text/plain

Gérard Meunier wrote:
> Douglas G. Danforth a écrit :
>> Folks,
>> Subject: Stores
>>
>> I am getting an error I can not interpret.
>> I believe I have done all of this before but
>> can not remember what I did then.
>>
>> Here is a chunk of code for which I get the warning:
>> "type is not identical with that of formal VAR-, IN- or OUT -parameter"
>>
>> Notice that there is no complaint in writing the store only in
>> reading it.
>>
>> -Doug

> Hello Doug,
>
> You must get parameter compatibility between Bits and Stores.Store
> when calling r.ReadStore(bits).
>
> An actual parameter a of type Ta is parameter compatible with a formal
> parameter f of type Tf if
> 1. Tf and Ta are equal types, or
> 2. f is a value parameter and Ta is assignment compatible with Tf, or
> 3. f is an IN or VAR parameter and Tf and Ta are record types and Ta
> is an extension of Tf.
>
> In your case, you have:
> PROCEDURE (VAR rd: Reader) ReadStore (OUT x: Store)
>
> so f (or x here) is not a value parameter and not an IN or VAR
> parameter. So only case 1 applies, and is not verified by your code.
> You should define:
>
> VAR s: Stores.Store;
>
> and write:
> r.ReadStore(s); bits := s(Bits);
>
> Cheers.
>
> Gérard

Gerard,
Thank you very much. One might think that r.ReadStore(s) would
fail since the type is not specific to Bits BUT that type information
has previously been written to the file so the system knows how

to allocate the appropriate data structure for Bits. One step
removed from the obvious but very nice in its generality.

Thanks again,
-Doug

--- BlackBox
--- send subject HELP or UNSUBSCRIBE to blackbox{([at]})nowhere.xy



----boundary-LibPST-iamunique-683337405_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"

e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzc1xmY2hhcnNldDAgQXJpYWw7fQ0Ke1xmMVxmbW9kZXJuIENvdXJpZXIgTmV3O30NCntcZjJc
Zm5pbFxmY2hhcnNldDIgU3ltYm9s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c
J2U5cmFyZFxwYXINClxwYXINCkdlcmFyZCxccGFyDQpUaGFuayB5b3UgdmVyeSBtdWNoLiAgT25l
IG1pZ2h0IHRoaW5rIHRoYXQgci5SZWFkU3RvcmUocykgd291bGRccGFyDQpmYWlsIHNpbmNlIHRo
ZSB0eXBlIGlzIG5vdCBzcGVjaWZpYyB0byBCaXRzIEJVVCB0aGF0IHR5cGUgaW5mb3JtYXRpb25c
cGFyDQpoYXMgcHJldmlvdXNseSBiZWVuIHdyaXR0ZW4gdG8gdGhlIGZpbGUgc28gdGhlIHN5c3Rl
bSBrbm93cyBob3dccGFyDQp0byBhbGxvY2F0ZSB0aGUgYXBwcm9wcmlhdGUgZGF0YSBzdHJ1Y3R1
cmUgZm9yIEJpdHMuICBPbmUgc3RlcFxwYXINCnJlbW92ZWQgZnJvbSB0aGUgb2J2aW91cyBidXQg
dmVyeSBuaWNlIGluIGl0cyBnZW5lcmFsaXR5LlxwYXINClxwYXINClRoYW5rcyBhZ2FpbixccGFy
DQotRG91Z1xwYXINClxwYXINCi0tLSBCbGFja0JveFxwYXINCi0tLSBzZW5kIHN1YmplY3QgSEVM
UCBvciBVTlNVQlNDUklCRSB0byBibGFja2JveEBvYmVyb24uY2h9fQBzLCBMTEMNClVz


----boundary-LibPST-iamunique-683337405_-_---
Received on Sat Sep 02 2006 - 23:08:10 UTC

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