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

From: [at]} <Chris>
Date: Wed, 30 Jan 2008 15:52:25 +1030

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

>-----Original Message-----
>From: BlackBox [mailto:BLACKBOX{([at]})nowhere.xy
>Sent: Tuesday, 29 January 2008 5:04 AM
>To: BLACKBOX{([at]})nowhere.xy
>Subject: Re: [BLACKBOX] IN Parameters - Making the design more regular
>
>Hi all,
>
>I can not see real advantages in the proposed change. There
>may under circumstances be some with respect to clarity of
>sourcecode when a procedure-parameter (RECORD, ARRAY, INTEGER,
>CHAR, BOOLEAN or whatever
>else) is declared as IN-parameter (remember all of them may be
>OUT-parameters anyway).

Exactly. Consistency can be very helpful in reducing confusion when learning
/ using a language.

>On the other side it must be clear that IN-parameters in the
>first line were not introduced for the purpose of clarifying
>source code. The idea, as far as I know, when introducing the
>keyword IN for RECORDs and ARRAYs was to avoid substantial
>amounts of allocating and deallocating of memory
....
....

That is certainly part of the story. Have a look at the section 'IN and OUT'
in BlackBox > Help > What's New for a good description of the motivation
behind the design.

>... every VAR-(IN-)parameter
>invokes an extra pointer, that is 4 bytes, and the necessary
>detours through memory at run time.
....
>But exactly this will be reintroduced into
>Component Pascal when parameters like (IN xyz: CHAR) are
>allowed.

I'm not sure that I understand what you are saying. 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:

VAR
  xyz-: CHAR;

>The slight improvement this might have on the source
>code level in my opinion is not worth the above mentioned run
>time drawbacks.

Does now knowing that such runtime drawbacks do not exist change your
opinion?

Thanks for taking to time to respond,

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


----
To unsubscribe, send a message with body "SIGNOFF BLACKBOX" to LISTSERV{([at]})nowhere.xy----boundary-LibPST-iamunique-644703560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0IHRvIHRoZSBzYW1lXHBhcg0KY29tcGlsZS10
aW1lIGNoZWNrcyBhcyBpdCB3b3VsZCBiZSBpZiBkZWZpbmVkIGFzIGEgcmVhZC1vbmx5IHZhcmlh
YmxlOlxwYXINClxwYXINClZBUlxwYXINCiAgeHl6LTogQ0hBUjtccGFyDQpccGFyDQo+VGhlIHNs
aWdodCBpbXByb3ZlbWVudCB0aGlzIG1pZ2h0IGhhdmUgb24gdGhlIHNvdXJjZSBccGFyDQo+Y29k
ZSBsZXZlbCBpbiBteSBvcGluaW9uIGlzIG5vdCB3b3J0aCB0aGUgYWJvdmUgbWVudGlvbmVkIHJ1
biBccGFyDQo+dGltZSBkcmF3YmFja3MuXHBhcg0KXHBhcg0KRG9lcyBub3cga25vd2luZyB0aGF0
IHN1Y2ggcnVudGltZSBkcmF3YmFja3MgZG8gbm90IGV4aXN0IGNoYW5nZSB5b3VyXHBhcg0Kb3Bp
bmlvbj9ccGFyDQpccGFyDQpUaGFua3MgZm9yIHRha2luZyB0byB0aW1lIHRvIHJlc3BvbmQsXHBh
cg0KXHBhcg0KQ2hyaXMgQnVycm93c1xwYXINCkNGQiBTb2Z0d2FyZVxwYXINCmh0dHA6Ly93d3cu
Y2Zic29mdHdhcmUuY29tL2NwXHBhcg0KXHBhcg0KXHBhcg0KLS0tLVxwYXINClRvIHVuc3Vic2Ny
aWJlLCBzZW5kIGEgbWVzc2FnZSB3aXRoIGJvZHkgIlNJR05PRkYgQkxBQ0tCT1giIHRvIExJU1RT
RVJWQExJU1RTLk9CRVJPTi5DSFx9fQAtcmU=
----boundary-LibPST-iamunique-644703560_-_---
Received on Wed Jan 30 2008 - 06:22:25 UTC

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