Re: [BLACKBOX] Variable IN parameters !

From: [at]} <Chris>
Date: Thu, 9 Aug 2012 22:10:27 +0930

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

> -----Original Message-----
> From: BlackBox [mailto:BLACKBOX{([at]})nowhere.xy
> Robert (SELEX GALILEO, UK)
> Sent: Thursday, 9 August 2012 2:02 AM
> To: BLACKBOX{([at]})nowhere.xy
> Subject: Re: [BLACKBOX] Windows 7
>
>
> PS - I am surprised no one else has commented on the Variable IN parameter
> 'bug'.
>
> I intend to try it with Gardens Point, when I find some time .....
>

I've tried it with GPCP and the result is the same. Note the following:

1. A direct assignment to the receiver in the body of the function where it
is declared as IN, IS trapped as a compile-time error e.g:

PROCEDURE (IN box : Box) Salt, NEW;
  BEGIN
    box.k := 5
  END Salt;


2. There could be an arbitrary number of levels involved before Sugar is
called and an assignment actually takes place:

PROCEDURE (VAR box : Box) Sugar, NEW;
  BEGIN
    box.k := 5
  END Sugar;

PROCEDURE (VAR box : Box) Spice, NEW;
  ...
  ...

PROCEDURE (VAR box : Box) Pepper, NEW;
  BEGIN
    box.Spice
  END Pepper;

PROCEDURE (IN box : Box) Salt, NEW;
  BEGIN
    box.Pepper
  END Salt;


3. Consider the situation where parameters rather than receivers are
involved:

PROCEDURE Sugar(VAR box: Box);
BEGIN
  box.k := 5;
END Sugar;
  
PROCEDURE Spice(IN box: Box);
BEGIN
  Sugar(box)
END Spice;
  
The compiler does report a compile-time error for:

   Sugar(box)

But not because of the assignment in the body of Sugar, but because an IN
parameter is being passed to a procedure that expects a VAR parameter.


4. A compile-time error would result even if there is no assignment to box:

PROCEDURE Sugar(VAR box: Box);
BEGIN
END Sugar;

Would you want the same to apply to receivers? i.e. would you want the
following to result in an error?

PROCEDURE (VAR box : Box) Pepper, NEW;
  BEGIN
  END Pepper;

PROCEDURE (IN box : Box) Salt, NEW;
  BEGIN
    box.Pepper
  END Salt;

Cheers
Chris

Chris Burrows
CFB Software
http://www.cfbsoftware.com/gpcp


----
To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to LISTSERV{([at]})nowhere.xy----boundary-LibPST-iamunique-713161153_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"
e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGZiaWRpcyBcZGVmZjB7XGZvbnR0YmwN
CntcZjBcZnN3aXNzIEFyaWFsO30NCntcZjFcZm1vZGVybiBDb3VyaWVyIE5ldzt9DQp7XGYyXGZu
aWxcZmNoYXJzZXQyIFN5bWJvbDt9DQp7XGYzXGZtb2Rlcm5cZmNoYXJzZXQwIENvdXJpZXIgTmV3
O319DQp7XGNvbG9ydGJsXHJlZDBcZ3JlZW4wXGJsdWUwO1xyZWQwXGdyZWVuMFxibHVlMjU1O30N
Clx1YzFccGFyZFxwbGFpblxkZWZ0YWIzNjAgXGYwXGZzMjAgPiAtLS0tLU9yaWdpbmFsIE1lc3Nh
Z2UtLS0tLVxwYXINCj4gRnJvbTogQmxhY2tCb3ggW21haWx0bzpCTEFDS0JPWEBMSVNUUy5PQkVS
T04uQ0hdIE9uIEJlaGFsZiBPZiBDYW1wYmVsbCxccGFyDQo+IFJvYmVydCAoU0VMRVggR0FMSUxF
TywgVUspXHBhcg0KPiBTZW50OiBUaHVyc2RheSwgOSBBdWd1c3QgMjAxMiAyOjAyIEFNXHBhcg0K
PiBUbzogQkxBQ0tCT1hATElTVFMuT0JFUk9OLkNIXHBhcg0KPiBTdWJqZWN0OiBSZTogW0JMQUNL
Qk9YXSBXaW5kb3dzIDdccGFyDQo+IFxwYXINCj4gXHBhcg0KPiBQUyAtIEkgYW0gc3VycHJpc2Vk
IG5vIG9uZSBlbHNlIGhhcyBjb21tZW50ZWQgb24gdGhlIFZhcmlhYmxlIElOIHBhcmFtZXRlclxw
YXINCj4gJ2J1ZycuXHBhcg0KPiBccGFyDQo+IEkgaW50ZW5kIHRvIHRyeSBpdCB3aXRoIEdhcmRl
bnMgUG9pbn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ugd2FudCB0aGUgc2FtZSB0byBhcHBseSB0byByZWNlaXZlcnM/IGkuZS4gd291
bGQgeW91IHdhbnQgdGhlXHBhcg0KZm9sbG93aW5nIHRvIHJlc3VsdCBpbiBhbiBlcnJvcj9ccGFy
DQpccGFyDQpQUk9DRURVUkUgKFZBUiBib3ggOiBCb3gpIFBlcHBlciwgTkVXO1xwYXINCiAgQkVH
SU5ccGFyDQogIEVORCAgUGVwcGVyO1xwYXINClxwYXINClBST0NFRFVSRSAoSU4gYm94IDogQm94
KSBTYWx0LCBORVc7XHBhcg0KICBCRUdJTlxwYXINCiAgICBib3guUGVwcGVyXHBhcg0KICBFTkQg
IFNhbHQ7XHBhcg0KXHBhcg0KQ2hlZXJzXHBhcg0KQ2hyaXNccGFyDQpccGFyDQpDaHJpcyBCdXJy
b3dzXHBhcg0KQ0ZCIFNvZnR3YXJlXHBhcg0KaHR0cDovL3d3dy5jZmJzb2Z0d2FyZS5jb20vZ3Bj
cFxwYXINClxwYXINClxwYXINCi0tLS1ccGFyDQpUbyB1bnN1YnNjcmliZSwgc2VuZCBhIG1lc3Nh
Z2Ugd2l0aCBib2R5ICJTSUdOT0ZGIEJMQUNLQk9YIiB0byBMSVNUU0VSVkBMSVNUUy5PQkVST04u
Q0hcfX0AOiAw
----boundary-LibPST-iamunique-713161153_-_---
Received on Thu Aug 09 2012 - 14:40:27 UTC

This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:29:59 UTC