From: Wolfgang J. <wj...@so...> - 2007-08-03 12:38:51
|
Hi, when experimenting with classes of the GEC it happens that compilation fails because of a catcall. To be precise, let `f' be a ET_DYNAMIC_FEATURE then adding the line if f.static_feature.name.name.is_equal("abc") then ... end leads to compiler message [CATCALL] class ET_C_GENERATOR (17182,4): type 'STRING_8' of actual argument #1 does not conform to type 'UC_UTF8_STRING' of formal argument in feature `is_equal' in class 'UC_UTF8_STRING' A similar catcall occurs if a DS_HASH_TABLE[INTEGER,STRING] object is created (a call at the object is not needed). WJ PS: Compile command: gec --nocc gec.ace -- Wolfgang Jansen University of Potsdam, Germany mailto: wj...@so... |
From: Eric B. <er...@go...> - 2007-08-03 13:49:01
|
Wolfgang Jansen wrote: > Hi, > > when experimenting with classes of the GEC it happens > that compilation fails because of a catcall. > To be precise, let `f' be a ET_DYNAMIC_FEATURE > then adding the line > > if f.static_feature.name.name.is_equal("abc") then ... end > > leads to compiler message > > [CATCALL] class ET_C_GENERATOR (17182,4): type 'STRING_8' of actual > argument #1 does not conform to type 'UC_UTF8_STRING' of formal argument > in feature `is_equal' in class 'UC_UTF8_STRING' Yes, the signature of `is_equal' is a real problem when we want to be CAT-call free. The workaround is to inherit from KL_IMPORTED_STRING_ROUTINES and write: if STRING_.same_string (f.static_feature.name.name, "abc") then Another solution: if f.static_feature.name.same_feature_name (create {ET_IDENTIFIER}.make ("abc")) then > A similar catcall occurs if a DS_HASH_TABLE[INTEGER,STRING] > object is created (a call at the object is not needed). For hash-tables, you need to create them that way in order to be CAT-call free: create ht.make_map (...) ht.set_key_equality_tester (string_equality_tester) or: create ht.make_with_equality_testers (..., Void, string_equality_tester) where `string_equality_tester' is inherited from KL_SHARED_STRING_EQUALITY_TESTER. -- Eric Bezault mailto:er...@go... http://www.gobosoft.com |
From: Wolfgang J. <wj...@so...> - 2007-08-03 15:04:27
|
Eric Bezault wrote: > Wolfgang Jansen wrote: >> Hi, >> >> when experimenting with classes of the GEC it happens >> that compilation fails because of a catcall. >> To be precise, let `f' be a ET_DYNAMIC_FEATURE >> then adding the line >> >> if f.static_feature.name.name.is_equal("abc") then ... end >> >> leads to compiler message >> >> [CATCALL] class ET_C_GENERATOR (17182,4): type 'STRING_8' of actual >> argument #1 does not conform to type 'UC_UTF8_STRING' of formal >> argument in feature `is_equal' in class 'UC_UTF8_STRING' > > Yes, the signature of `is_equal' is a real problem when > we want to be CAT-call free. The workaround is to inherit > from KL_IMPORTED_STRING_ROUTINES and write: > > if STRING_.same_string (f.static_feature.name.name, "abc") then > > Another solution: > > if f.static_feature.name.same_feature_name (create > {ET_IDENTIFIER}.make ("abc")) then > > >> A similar catcall occurs if a DS_HASH_TABLE[INTEGER,STRING] >> object is created (a call at the object is not needed). > > For hash-tables, you need to create them that way in order > to be CAT-call free: > > create ht.make_map (...) > ht.set_key_equality_tester (string_equality_tester) > > or: > > create ht.make_with_equality_testers (..., Void, > string_equality_tester) > > where `string_equality_tester' is inherited from > KL_SHARED_STRING_EQUALITY_TESTER. > > Thanks, it works (though it is hard to understand). -- Wolfgang Jansen University of Potsdam, Germany mailto: wj...@so... |
From: Eric B. <er...@go...> - 2007-08-03 17:07:31
|
Wolfgang Jansen wrote: > Eric Bezault wrote: >> Wolfgang Jansen wrote: >>> Hi, >>> >>> when experimenting with classes of the GEC it happens >>> that compilation fails because of a catcall. >>> To be precise, let `f' be a ET_DYNAMIC_FEATURE >>> then adding the line >>> >>> if f.static_feature.name.name.is_equal("abc") then ... end >>> >>> leads to compiler message >>> >>> [CATCALL] class ET_C_GENERATOR (17182,4): type 'STRING_8' of actual >>> argument #1 does not conform to type 'UC_UTF8_STRING' of formal >>> argument in feature `is_equal' in class 'UC_UTF8_STRING' >> Yes, the signature of `is_equal' is a real problem when >> we want to be CAT-call free. The workaround is to inherit >> from KL_IMPORTED_STRING_ROUTINES and write: >> >> if STRING_.same_string (f.static_feature.name.name, "abc") then >> >> Another solution: >> >> if f.static_feature.name.same_feature_name (create >> {ET_IDENTIFIER}.make ("abc")) then >> >> >>> A similar catcall occurs if a DS_HASH_TABLE[INTEGER,STRING] >>> object is created (a call at the object is not needed). >> For hash-tables, you need to create them that way in order >> to be CAT-call free: >> >> create ht.make_map (...) >> ht.set_key_equality_tester (string_equality_tester) >> >> or: >> >> create ht.make_with_equality_testers (..., Void, >> string_equality_tester) >> >> where `string_equality_tester' is inherited from >> KL_SHARED_STRING_EQUALITY_TESTER. >> >> > Thanks, it works (though it is hard to understand). Running gelint with the '--cat' option will tell you the code chain that could lead to the CAT-call. This might look too constraining to have theses compilation errors, but it's probably better to have them at compilation time than at run-time. At run-time, it's even harder to understand. BTW, I assumed you knew what a CAT-call is. If you don't, let me know and I'll show you a small example. -- Eric Bezault mailto:er...@go... http://www.gobosoft.com |