parameter type

User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

Re: parameter type

Post by Josef Templ »

Robert wrote:I have received the following contribution from member dsar (memberlist.php?mode=viewprofile&u=109):
Although it's correct that IN x: ARRAY 32 OF CHAR is not usable because of name equivalence, forward references shouldn't be type checked.

This problem was already issued and corrected in Oberon-2 in the last change (during 1996):

ftp://ftp.ssw.uni-linz.ac.at/pub/Oberon ... eList.Text

10 The formal parameter lists of the forward declaration and the actual declaration must be identical [not just match].

10.2 The formal parameter lists of both declarations [the type-bound procedure and its forward declaration] must be identical.

I guess with identical they meant textually identical. However removing "must match" with a reference to the Appendix A excludes the fact that they must be type checked.

I'm against to put new language features to a stable language, but it would be nice to improve Component Pascal in clarity and coherence (type checking of forward references doesn't make sense).
I have to check the details of the forward procedure checks in the compiler.
If anybody else is interested, it is in DevCPB.CheckParameters.

- Josef
User avatar
Josef Templ
Posts: 2047
Joined: Tue Sep 17, 2013 6:50 am

Re: parameter type

Post by Josef Templ »

The CP language report says:

"The formal parameter lists of the forward declaration and the actual declaration must match (see App. A) and the names of corresponding parameters must be equal."

This is the same, I think, as the Oberon-2 change in 1996 requires, isn't it?
"Identical" in Oberon-2 means matching parameter types AND equal parameter names.

- Josef
Post Reply