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

From: [at]} <CFB>
Date: Tue, 29 Jan 2008 21:41:55 +1030

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

> -----Original Message-----
> From: BlackBox [mailto:BLACKBOX{([at]})nowhere.xy
> Campbell, Robert (SELEX GALILEO, UK)
> Sent: Tuesday, 29 January 2008 7:26 PM
> To: BLACKBOX{([at]})nowhere.xy
> Subject: Re: [BLACKBOX] IN Parameters - Making the design more regular
>
> Chris
>
> I think your words could benefit from being more explicit. I
> am probably not the only person who thinks:
>
> "local variables to which the value of the corresponding actual
> parameter is assigned"

> implies a copy, or that if you just pass the address of an array to a
> procedure,
> to implement IN, that the array being read IS still accessable
> "from outside that procedure".
>

Hi Robert,

Yes - it should be read as a first draft. Any suggestions for clarification
are welcome. I have to admit the idea is not all mine. I have had misgivings
about the implementation of IN parameters for quite some time but the
proposed solution was inspired by Wirth's recent work. Maybe his actual
words would be less open to misinterpretation. In his latest language design
(Oberon-SA, 2007) he says:

"10.1. Formal parameters

Formal parameters are identifiers which denote actual parameters specified
in the procedure call. The correspondence between formal and actual
parameters is established when the procedure is called. There are three
kinds of parameters, namely value, constant, and variable parameters. A
variable parameter corresponds to an actual parameter that is a variable,
and it stands for this variable. A constant parameter corresponds to an
actual parameter that is an expression, and it stands for its value, which
cannot be changed by assignment. A value parameter represents a local
variable to which the value of the actual expression is assigned. The kind
of a parameter is indicated in the formal parameter list: Variable
parameters are denoted by the symbol VAR, constant parameters by the symbol
CONST, and value parameters by the absence of such a prefix."

When I read this I substituted the word "input" for "constant" and "IN" for
"CONST" and that started me thinking ....

Is that any clearer?

Interestingly, he also adds the following constraint:

  "Value parameters must not be of an array or record type."

ensuring that the programmer is prevented from writing inefficient code.

Regards,
Chris

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-1309019028_-_-
Content-type: application/rt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ated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:31:06 UTC