10-0037 - COBOLStandard.info

advertisement
17 June 2010
Document Number:
DF-51.3
PL22.4/10-0037
Page
1
of
4
COBOL Task Group
Defect Report Response DF-51.3 (for 05-0222)
Subject:
ACTIVE-CLASS object reference as Property
Author: Wataru Takagi
Previous Version:
08-0143 (D-51.1) - ACTIVE-CLASS object reference as Property
References in Document:
1.
ISO/IEC 1989:2002, Programming language COBOL:
a.
Page 94, 8.4.2.4.2, Inline method invocation, syntax rule 4
b.
page 94, 8.4.2.4.2, Inline method invocation, general rule 1b
c.
Page 98, 8.4.2.9, Object Property, syntax rules 5 to 6
d.
Page 98, 8.4.2.9, Object Property, general rules 1 to 3
e.
Page 181, 11.6.2, METHOD-ID paragraph, syntax rules 6 to 7
f.
Page 330, 13.16.40, PROPERTY clause
g.
Page 365, 13.16.58 USAGE clause, general rules 14e
h.
Page 405, 14.7.1.2.1, (Conformance for parameters) Elementary items passed by
reference
i.
Page 406, 14.7.1.2.2, (Conformance for parameters) Elementary items passed by
content
j.
Page 407-408, 14.7.2.2, (Conformance for returning items) Elementary items
Other References:
2.
05-0222 – Interpretation Request: ACTIVE-CLASS object reference as Property (Takagi)
Submitter:
Wataru Takagi and Katsuhiko Ono, submitted directly to J4
Nature of Defect:
The rules for object properties (references 1c and 1d) state that the description of the conceptual
temporary data item for an object property is the same as the description of the
parameter/returning item of the set/get property method. However, when the object property is
an object reference described with the ACTIVE-CLASS phrase, the implied description of the
ACTIVE-CLASS where the object property is used may be different from the one where it is
defined (reference 1g).
17 June 2010
Document Number:
DF-51.3
PL22.4/10-0037
Page
2
of
4
Consider that a class C1 defines a PROPERTY item described as an object reference with
ACTIVE-CLASS; then it shall contain a reference to an object of class C1 or its subclasses. If
the name of that property item is declared in the REPOSITORY paragraph of another class C2,
the property item is projected in class C2 to be as object reference with ACTIVE-CLASS, so that
it shall contain a reference to an object of class C2 or its subclasses. The inconsistency is that
the range of allowable values in the same property item differs between the defining class C1
and the referencing class C2.
Solution Proposed by Submitter:
Although it might be possible to specify the behavior of the object property where the property is
described with the ACTIVE-CLASS phrase (as in references 1i and 1j), this approach introduces
more error-prone specifications in the language, especially when you read the programs that
use this kind of property.
We propose to prohibit the use of such object properties by adding following restrictions to the
rules in references 1e and 1f.
1.
Page 181, 11.6.2, METHOD-ID paragraph, SR 6 (begins “If the GET phrase is
specified...”), add a new last sentence:
"The RETURNING item shall not be an object reference described with the ACTIVECLASS phrase.”
2.
Page 181, 11.6.2, METHOD-ID paragraph, SR 7 (begins “If the SET phrase is
specified...”), add a new last sentence:
"The USING parameter shall not be an object reference described with the ACTIVECLASS phrase.”
3.
Page 330, 13.16.40, PROPERTY clause, add a new syntax rule as follows:
"5) The PROPERTY clause shall not be specified for data items of usage object reference
described with an ACTIVE-CLASS phrase”.
Initial Discussion:
At meeting 254, the interpretation request in 05-0222 was assigned to this author (Takagi,
ITSCJ) for investigation.
Discussion at meeting 254:
15.2 05-0222 - ACTIVE-CLASS object reference as Property (Ono/Takagi)
The author prepared 05-0253 as D-51 reflecting the issues raised by 05-0222.
The motion to approve J4/05-0253 (D-51.1) was passed by a vote of Yes - 4, No - 0.
The author was directed to create DF-51.1 reflecting this approval.
Discussion at meeting 269:
17 June 2010
Document Number:
DF-51.3
PL22.4/10-0037
Page
3
of
4
The concern about the similarity with the inline method invocation was expressed during the
meeting. The author agreed to do further investigation.
Discussion before meeting 277:
For the inline method invocation, the RETURNING parameter in the invoked method shall not be
described with the ACTIVE-CLASS phrase.
The inline method invocation references the temporary data item that has the same description,
class, and category as the RETURNING parameter in the specification of the invoked method
(refernce 1b). As a note, the inline method invocation can only be the sending item, as described
in page 94, 8.4.2.4.2, Inline method invocation, SR2).
Proposed Response
The use of a property whose usage is object reference active-class should be prohibited.
J4 Determined Nature of Defect:
If an object property is referenced, and the description of that object property includes a USAGE
clause with the OBJECT REFERENCE ACTIVE-CLASS phrase or the OBJECT REFERENCE
FACTORY OF ACTIVE-CLASS phrase, then the actual description of the object property in the
source unit in which it is referenced may differ from the description of the object property in the
source unit in which it is defined, according to Reference 1g.
PL22.4 Determined Nature of Defect:
When an object property is an object reference described with the ACTIVE-CLASS phrase, the
implied description of the ACTIVE-CLASS where the object property is used may be different
from the one where it is defined.
If a data item described with an ACTIVE-CLASS phrase references an object, the object shall be
of the same class as the object that was used to invoke the method in which this data
description entry is specified (reference 1g). And the description of an object property used as a
sending item is the same as the description of the returning item of the get property method and
that the description of an object property used as a receiving item is the same as the description
of the using parameter of the set property method (references 1c and 1d).
However, the class of the object that was used to invoke the method in which the object property
is invoked may be different from the class of the object that is used to invoke the object property.
If the RETURNING parameter of the method invoked by an inline method invocation is described
with the ACTIVE-CLASS phrase, the same problem exists as the get object property. The inline
method invocation references the temporary data item that has the same description, class, and
category as the RETURNING parameter in the specification of the invoked method (reference
1b).
17 June 2010
Document Number:
DF-51.3
PL22.4/10-0037
Page
4
of
4
When an object reference described with an ACTIVE-CLASS phrase is specified as a USING
parameter or as a returning item of a method, references 1h, 1i, and 1j prevent the problem
identified for the object properties and inline method invocations.
Changes Needed:
The following changes to the Standard are needed:
1.
Page 94, 8.4.2.4.2, Inline method invocation, SR 4, change in part to read:
"... shall not be described with the ANY LENGTH clause or with the ACTIVE-CLASS
phrase.”
2.
Page 181, 11.6.2, METHOD-ID paragraph, SR 6, add a new last sentence:
"The returning item shall not be an object reference described with the ACTIVE-CLASS
phrase.”
3.
Page 181, 11.6.2, METHOD-ID paragraph, SR 7, add a new last sentence:
"The USING parameter shall not be an object reference described with the
ACTIVE-CLASS phrase.”
4.
Page 330, 13.16.40.2, PROPERTY clause, add a new syntax rule as follows:
"5) The PROPERTY clause shall not be specified for data items of usage object reference
described with an ACTIVE-CLASS phrase”.
Download