From: Jakob H. <jak...@tu...> - 2007-09-07 14:29:01
|
Maybe the developer list is more appropriate for this... see below. Cheers, Jakob ------- Forwarded message ------- From: "Jakob Henriksson" <jak...@tu...> To: "Reuseware Users" <reu...@li...> Cc: Subject: type casting in composition programs Date: Fri, 07 Sep 2007 14:09:16 +0200 Hi, One of the modular xcerpt composers currently look like this (slightly modified from SVN version to show the point): define composer modularxcerpt.QualifiedQueryTermComposer(moduleName, queryTerm) { // Resolve the fragment name into a location (URI, the module ID) fragmentlist componentmodel.Location moduleID =3D ->moduleName; // Use store: "out" fragmentlist xcerpt.QueryTerm qtWrapper =3D 'store [ modul [ <<moduleID>> ], visibility [ "out" ], <<qTerm>> ]'.mxcerpt; = fragmentlist xcerpt.QuotedString quotedModuleID =3D '"' + moduleID + '"'.mxcerpt; bind moduleID on qtWrapper with quotedModuleID; = // Bind intentional query term to store wrapper bind qTerm on qtWrapper with queryTerm; // Return store wrapper return qtWrapper; } The QuotedString quotedModuleID is constructed with a "hack": untyped string concatenation. I want to bind the slot 'moduleID' with the value = of the fragment moduleID (of type Location). Instead of Lines 10-11, removi= ng the "hack", I want to write: bind moduleID on qtWrapper with (xcerpt.QuotedString)moduleID; Thus casting the type of moduleID from Location to QuotedString (which i= s possible, since the value of the fragment can be represented both as a Location and as a quoted string). Notice that the '"' of the quoted strings are (should be) just concrete syntax, so they shouldn't be a problem. Is this a reasonable solution? Can we implement it? Is this relevant to Sven's improvements of the composition language? Let me know what you think. Cheers, Jakob ps. is this the right forum for these kinds of issues? ds. -- = REWERSE WG I3 Assistant Dresden - Technical University Office: +49 (0) 351 463 38608 Mobile: +49 (0) 172 490 3086 |