Re: [BLACKBOX] IN Parameters - Making the design more regular

From: [at]} <hvl>
Date: Wed, 30 Jan 2008 19:50:00 +0100

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

Hi Chris,

After your latest explanations I rethought my arguments and looked a your
example(s. below):

> Consider this code:
> PROCEDURE P(x: INTEGER);
> BEGIN
> ...
> SomeOtherProcedure(x);
> ...
> (* Who knows what the value of x is? *)

In this case I cannot see a big advantage of x being an IN parameter of
procedure P because the writer of procedure P ( and consequently procedure
SomeOtherProcedure) should and hopefully does know the value of x as
he/she is the only one having been able to modify the value of the local
variable x, which means that even when by some (parallel) exterior process
the value of x in the outer scope is changed and consequently differs from
x's value in the inner scope when calling procedure SomeOtherProcedure
this procedure uses the inner value (am I right?).
The real advantage of IN parameters for me shows up when it comes to
interfaces i.e. exported procedures. Here your proposal to allow this
keyword for all variable types would indeed on one hand make the language
more "regular" as you said, on the other hand, more important I believe,
safer as the caller of an otherwise unknown procedure from an imported
module can be shure the value of x will be unaltered after procedure
execution, which certainly improves code reliability.
This already was on my mind when I objected to the proposed change,
objected because of my - obviously false - ideas of memory handling.

Your statements:

> I'm not proposing that non-structured IN parameters are handled in the
> same way
> as VAR parameters.
> That only should be the case for records and arrays. The way I have
> implemented it is that (IN xyz: CHAR) is implemented *identically* to
> (xyz: CHAR) as far as memory allocation etc. goes. The only difference
> is that xyz is subsequently subject to the same
> compile-time checks as it would be if defined as a read-only variable.

and

> The way I have implemented it should generate identical code.

look quite convincing and if this is so I happily withdraw my objections
gratefully relying on the compiler writer (which I am not).

Regards

Harro


----
To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to LISTSERV{([at]})nowhere.xy----boundary-LibPST-iamunique-103206610_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"
e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzcyBBcmlhbDt9DQp7XGYx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mUgaW1wbGVtZW50ZWQgaXQgc2hvdWxk
IGdlbmVyYXRlIGlkZW50aWNhbCBjb2RlLlxwYXINClxwYXINCmxvb2sgcXVpdGUgY29udmluY2lu
ZyBhbmQgaWYgdGhpcyBpcyBzbyBJIGhhcHBpbHkgd2l0aGRyYXcgbXkgb2JqZWN0aW9ucyAgXHBh
cg0KZ3JhdGVmdWxseSByZWx5aW5nIG9uIHRoZSBjb21waWxlciB3cml0ZXIgKHdoaWNoIEkgYW0g
bm90KS5ccGFyDQpccGFyDQpSZWdhcmRzXHBhcg0KXHBhcg0KSGFycm9ccGFyDQpccGFyDQpccGFy
DQotLS0tXHBhcg0KVG8gdW5zdWJzY3JpYmUsIHNlbmQgYSBtZXNzYWdlIHdpdGggYm9keSAiU0lH
Tk9GRiBCTEFDS0JPWCIgdG8gTElTVFNFUlZATElTVFMuT0JFUk9OLkNIfX0AAExJ6A==
----boundary-LibPST-iamunique-103206610_-_---
Received on Wed Jan 30 2008 - 19:50:00 UTC

This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:31:05 UTC