Issue 13926: Template Binding Question (uml2-rtf) Source: NASA (Dr. Maged Elaasar, Maged.E.Elaasar(at)jpl.nasa.gov) Nature: Uncategorized Issue Severity: Summary: In the spec, there is a constraint on TemplateParameterSubstitution, as follows: actual->forAll(a | a.isCompatibleWith(formal.parameteredElement)) "actual" and "formal" are TemplatableElement. So looking up "isCompatibleWith" definition in the spec, I find this: The query isCompatibleWith() determines if this parameterable element is compatible with the specified parameterable element. By default parameterable element P is compatible with parameterable element Q if the kind of P is the same or a subtype as the kind of Q. Subclasses should override this operation to specify different compatibility constraints. ParameterableElement::isCompatibleWith(p : ParameterableElement) : Boolean; isCompatibleWith = p->oclIsKindOf(self.oclType) This means if I defined a class template with a template parameter linked to Interface A (a ParametrableElement), and I used this interface to type a property inside the class template, that I cannot substite the interface with Class B that realizes Interface A, because Class B and Interface A do not have compatible kinds (metaclasses). Is this what the constraint is saying? Is this Valid? Resolution: Revised Text: Actions taken: April 29, 2009: received issue Discussion: End of Annotations:===== ubject: Template Binding Question To: uml2-rtf@omg.org X-Mailer: Lotus Notes Release 7.0 HF277 June 21, 2006 From: Maged Elaasar Date: Wed, 29 Apr 2009 14:37:53 -0400 X-MIMETrack: Serialize by Router on D25ML03/25/M/IBM(Release 7.0.3FP1|February 24, 2008) at 04/29/2009 14:37:54 Hi All, I the spec, there is a constraint on TemplateParameterSubstitution, as follows: actual->forAll(a | a.isCompatibleWith(formal.parameteredElement)) "actual" and "formal" are TemplatableElement. So looking up "isCompatibleWith" definition in the spec, I find this: The query isCompatibleWith() determines if this parameterable element is compatible with the specified parameterable element. By default parameterable element P is compatible with parameterable element Q if the kind of P is the same or a subtype as the kind of Q. Subclasses should override this operation to specify different compatibility constraints. ParameterableElement::isCompatibleWith(p : ParameterableElement) : Boolean; isCompatibleWith = p->oclIsKindOf(self.oclType) This means if I defined a class template with a template parameter linked to Interface A (a ParametrableElement), and I used this interface to type a property inside the class template, that I cannot substite the interface with Class B that realizes Interface A, because Class B and Interface A do not have compatible kinds (metaclasses). Is this what the constraint is saying? Is this Valid? -------------------------------------------------------------------------------- Maged Elaasar, PhD Candidate Senior Software Engineer, Rational Modeling Tools CAS RSM, OMG Contributing Member IBM Canada, Ottawa Lab melaasar@ca.ibm.com Tel: 613-270-4651 From: Steve Cook To: Maged Elaasar , "uml2-rtf@omg.org" Date: Thu, 30 Apr 2009 11:28:32 +0100 Subject: RE: Template Binding Question Thread-Topic: Template Binding Question Thread-Index: AcnI+lDH9eVBHOzER+aJ6joncVwtZgAhAB6g Accept-Language: en-US X-MS-Has-Attach: yes X-MS-TNEF-Correlator: acceptlanguage: en-US Maged You might also want to take a look at issue 13164 which I raised. -- Steve From: Maged Elaasar [mailto:melaasar@ca.ibm.com] Sent: 29 April 2009 19:38 To: uml2-rtf@omg.org Subject: Template Binding Question Hi All, I the spec, there is a constraint on TemplateParameterSubstitution, as follows: actual->forAll(a | a.isCompatibleWith(formal.parameteredElement)) "actual" and "formal" are TemplatableElement. So looking up "isCompatibleWith" definition in the spec, I find this: The query isCompatibleWith() determines if this parameterable element is compatible with the specified parameterable element. By default parameterable element P is compatible with parameterable element Q if the kind of P is the same or a subtype as the kind of Q. Subclasses should override this operation to specify different compatibility constraints. ParameterableElement::isCompatibleWith(p : ParameterableElement) : Boolean; isCompatibleWith = p->oclIsKindOf(self.oclType) This means if I defined a class template with a template parameter linked to Interface A (a ParametrableElement), and I used this interface to type a property inside the class template, that I cannot substite the interface with Class B that realizes Interface A, because Class B and Interface A do not have compatible kinds (metaclasses). Is this what the constraint is saying? Is this Valid? -------------------------------------------------------------------------------- Maged Elaasar, PhD Candidate Senior Software Engineer, Rational Modeling Tools CAS RSM, OMG Contributing Member IBM Canada, Ottawa Lab melaasar@ca.ibm.com Tel: 613-270-4651 Subject: RE : Template Binding Question Date: Fri, 8 May 2009 08:42:45 +0200 X-MS-Has-Attach: X-MS-TNEF-Correlator: Thread-Topic: Template Binding Question Thread-Index: AcnPRS6EglUh2VwZSvmin8bCqKKe2QAYQCRS From: "CUCCURU Arnaud" To: "Juergen Boldt" , "Maged Elaasar" , X-OriginalArrivalTime: 08 May 2009 06:42:46.0416 (UTC) FILETIME=[326BF100:01C9CFA8] Hi, It seems that the problem described by Maged is very related to issue 13257 from James Bruck: "Say we want to expose a ParameterableElement as a formal template parameter. If we want to create the following List, then the template parameter would refer to some parameterable element E whose type we would have to choose (say uml:Class). Now, say we wanted to create List< Interface >, or List < Class >, or List < DataType >. I don't think we would be able to then create TemplateParameterSubstitution for all these elements since the type of formal and actual parameters are inconsistent. The problem is that we must pick a concrete type for that ParameterableElement - we can't for example use Classifier as the template parameter because it's abstract." Arnaud -------- Message d'origine-------- De: Juergen Boldt [mailto:juergen@omg.org] Date: jeu. 07/05/2009 20:53 À: Maged Elaasar; uml2-rtf@omg.org Objet : Re: Template Binding Question should I file as an issue ? -Juergen At 02:37 PM 4/29/2009, Maged Elaasar wrote: >Hi All, > >I the spec, there is a constraint on TemplateParameterSubstitution, >as follows: > >actual->forAll(a | a.isCompatibleWith(formal.parameteredElement)) > >"actual" and "formal" are TemplatableElement. So looking up >"isCompatibleWith" definition in the spec, I find this: > >The query isCompatibleWith() determines if this parameterable >element is compatible with the specified parameterable element. By >default parameterable element P is compatible with parameterable >element Q if the kind of P is the same or a subtype as the kind of >Q. Subclasses should override this operation to specify different >compatibility constraints. > >ParameterableElement::isCompatibleWith(p : ParameterableElement) : Boolean; >isCompatibleWith = p->oclIsKindOf(self.oclType) > >This means if I defined a class template with a template parameter >linked to Interface A (a ParametrableElement), and I used this >interface to type a property inside the class template, that I >cannot substite the interface with Class B that realizes Interface >A, because Class B and Interface A do not have compatible kinds (metaclasses). > >Is this what the constraint is saying? Is this Valid? > > >---------- >Maged Elaasar, PhD Candidate >Senior Software Engineer, Rational Modeling Tools >CAS RSM, OMG Contributing Member >IBM Canada, Ottawa Lab >melaasar@ca.ibm.com >Tel: 613-270-4651 > >RSDC09 > 17ca74.jpg From: Steve Cook To: Juergen Boldt , Maged Elaasar , "uml2-rtf@omg.org" Date: Fri, 8 May 2009 11:37:29 +0100 Subject: RE: Template Binding Question Thread-Topic: Template Binding Question Thread-Index: AcnPRgwOpF3TazxtTLGkZt9smBbm3AAgrdJw Accept-Language: en-US X-MS-Has-Attach: yes X-MS-TNEF-Correlator: acceptlanguage: en-US Juergen I suggest yes, please file as an issue and the RTF will eventually decide whether it is a duplicate . there are several issues in this area and it would be good to have all the relevant evidence captured properly. Thanks -- Steve From: Juergen Boldt [mailto:juergen@omg.org] Sent: 07 May 2009 19:53 To: Maged Elaasar; uml2-rtf@omg.org Subject: Re: Template Binding Question should I file as an issue ? -Juergen At 02:37 PM 4/29/2009, Maged Elaasar wrote: Hi All, I the spec, there is a constraint on TemplateParameterSubstitution, as follows: actual->forAll(a | a.isCompatibleWith(formal.parameteredElement)) "actual" and "formal" are TemplatableElement. So looking up "isCompatibleWith" definition in the spec, I find this: The query isCompatibleWith() determines if this parameterable element is compatible with the specified parameterable element. By default parameterable element P is compatible with parameterable element Q if the kind of P is the same or a subtype as the kind of Q. Subclasses should override this operation to specify different compatibility constraints. ParameterableElement::isCompatibleWith(p : ParameterableElement) : Boolean; isCompatibleWith = p->oclIsKindOf(self.oclType) This means if I defined a class template with a template parameter linked to Interface A (a ParametrableElement), and I used this interface to type a property inside the class template, that I cannot substite the interface with Class B that realizes Interface A, because Class B and Interface A do not have compatible kinds (metaclasses). Is this what the constraint is saying? Is this Valid? -------------------------------------------------------------------------------- Maged Elaasar, PhD Candidate Senior Software Engineer, Rational Modeling Tools CAS RSM, OMG Contributing Member IBM Canada, Ottawa Lab melaasar@ca.ibm.com Tel: 613-270-4651 Subject: RE: issue 13926 -- UML 2 RTF issue Date: Fri, 8 May 2009 11:40:08 -0400 X-MS-Has-Attach: yes X-MS-TNEF-Correlator: Thread-Topic: issue 13926 -- UML 2 RTF issue Thread-Index: AcnP5YDHwZa5GQvVRV+54sLWRNrY+wADC5/w From: "Ed Seidewitz" To: There is actually a deeper problem here, I think. With a ClassifierTemplateParameter, it is possible to specify a set of constrainingClassifiers. Obviously, these are intended to constrain the allowed actuals for a formal classifier template parameter. But I don.t see anywhere that this is enforced. ClassifierTemplateParameter also has an allowSubstitutable attribute that defaults to true. If this attribute is true, then .there must be a constraining classifier. and .any classifier that is compatible with this constraining classifier can be substituted.. (Otherwise, .it must be either these classifiers or one of their subclasses..) Now, in the default case of allowSubstitutable=true, it certainly would not be very useful to define .compatability. with constraining classifiers as defined in ParameterableElement.since this wouldn.t really provide any additional constraint at all! I imagine that the intent here is .conformance. (that is the word used later in an example) rather than .compatibility.. That is, the actual classifier should .conform. to the constraining classifiers in a similar sense to that required for interface realization: the actual classifier should have features that conform (in a redefinability sense) to all the features defined in the constraining classifiers. If the above was the case, then one could specify an interface template parameter with an interface as a constraining classifier, perhaps giving a few required operations, and any class that .conforms. to that interface (e.g., one that realizes it) could be substituted as an actual. I think this would solve the problem in the issue below (and related issues). -- Ed -------------------------------------------------------------------------------- From: Juergen Boldt [mailto:juergen@omg.org] Sent: Friday, May 08, 2009 9:57 AM To: issues@omg.org; uml2-rtf@omg.org Subject: issue 13926 -- UML 2 RTF issue Subject: Template Binding Question To: uml2-rtf@omg.org X-Mailer: Lotus Notes Release 7.0 HF277 June 21, 2006 From: Maged Elaasar Date: Wed, 29 Apr 2009 14:37:53 -0400 X-MIMETrack: Serialize by Router on D25ML03/25/M/IBM(Release 7.0.3FP1|February 24, 2008) at 04/29/2009 14:37:54 Hi All, I the spec, there is a constraint on TemplateParameterSubstitution, as follows: actual->forAll(a | a.isCompatibleWith(formal.parameteredElement)) "actual" and "formal" are TemplatableElement. So looking up "isCompatibleWith" definition in the spec, I find this: The query isCompatibleWith() determines if this parameterable element is compatible with the specified parameterable element. By default parameterable element P is compatible with parameterable element Q if the kind of P is the same or a subtype as the kind of Q. Subclasses should override this operation to specify different compatibility constraints. ParameterableElement::isCompatibleWith(p : ParameterableElement) : Boolean; isCompatibleWith = p->oclIsKindOf(self.oclType) This means if I defined a class template with a template parameter linked to Interface A (a ParametrableElement), and I used this interface to type a property inside the class template, that I cannot substite the interface with Class B that realizes Interface A, because Class B and Interface A do not have compatible kinds (metaclasses). Is this what the constraint is saying? Is this Valid? -------------------------------------------------------------------------------- Maged Elaasar, PhD Candidate Senior Software Engineer, Rational Modeling Tools CAS RSM, OMG Contributing Member IBM Canada, Ottawa Lab melaasar@ca.ibm.com Tel: 613-270-4651