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

From: [at]} <CFB>
Date: Tue, 29 Jan 2008 23:54:27 +1030

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

> -----Original Message-----
> From: BlackBox [mailto:BLACKBOX{([at]})nowhere.xy
> Josef Templ
> Sent: Tuesday, 29 January 2008 10:28 PM
> To: BLACKBOX{([at]})nowhere.xy
> Subject: Re: [BLACKBOX] IN Parameters - Making the design more regular
...
...
>
> IN means that you are not allowed to change a VAR-parameter
> inside the procedure, however it might be changed
> outside the procedure by some side effect. Therefore it is
> not strictly
> constant.

CONST as used in Oberon-SA to qualify a parameter is different to the
traditional use of the CONST keyword.

"A constant parameter corresponds to an actual parameter that is an
expression"

The simplest form of an expression is a designator which eventually reduces
to simply the name of a variable. Thus the name of a variable can be passed
as an actual CONST parameter. That variable can also be changed outside the
procedure and is not strictly constant. The CONST keyword merely serves to
protect the parameter from modification inside the procedure.

>
> IMHO the two concepts cannot be merged into one without
> breaking existing code.

I disagree as I fail to see a fundamental difference between the two
concepts - they are just expressed in different ways. The same problems are
being solved (i.e. efficient passing of structured parameters and read-only
behaviour). The end result is the same. However, BlackBox chooses to only
include records and arrays for IN parameters. Oberon-SA has no such
limitation for CONST parameters

I have not found any code breaking with the few examples that I have already
compiled (including the compiler itself of course!) Did you have an example
in mind?

> Also, the benefit is marginal in my experience.
>

Do you consider the benefit of read-only exports to be marginal? I consider
the benefits of both types of read-only variables to be similar - the
primary difference is the scope. For exports the read-only scope is the
module, for input parameters the read-only scope is the procedure.

> I doubt that Wirth allows the usage of const parameters in
> ConstExpression
> as for example in the declaration of an array type inside a procedure.

I agree that this would not be allowed. "A constant expression can be
evaluated by a mere textual scan without actually executing the program" The
program would generally need to be executed to evaluate the value of a CONST
parameter.

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-944966230_-_-
Content-type: application/rt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GRiBCTEFDS0JPWCIgdG8gTElTVFNFUlZATElTVFMuT0JFUk9O
LkNIXH19AGx0bw==
----boundary-LibPST-iamunique-944966230_-_---
Received on Tue Jan 29 2008 - 14:24:27 UTC

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