From: Wolfgang J. <wj...@so...> - 2007-08-10 08:55:45
|
Eric Bezault wrote: > Howard Thomson wrote: > >> Hi Wolfgang and Eric, >> >> According to ETL, the '$' operator applied to a non-constant feature should >> provide its POINTER address, such that when the pointer is passed to an >> external routine, that routine can modify the feature, probably returning a >> previously supplied value. >> >> Unfortunately, EiffelStudio (I think) does not follow ETL and uses, for a >> reference feature, the '$' operator as an equivalent of SmartEiffel's >> to_external concept to return the POINTER equivalent of the address of the >> referred-to object, which is what Eric has implemented to be compatible with >> ES >> > > Yes. I think that the idea is that $ does not return the > address of the attribute entity in the enclosing object, > but the address of the attribute object. So if the attribute > is expanded, the address of the object is indeed the same > as the address of the attribute entity in the enclosing > object. But for reference attributes, the address of the > object is what is stored in the attribute entity. So, in > a sense it is consistent between expanded and reference. > It's just that it is returning the address of the attribute > object and not the address of the attribute entity. > > I think that ISE gives access to the attribute entity > address through its class INTERNAL. Because I want to > implement features of INTERNAL in terms of features of > class TYPE, I think that I will make this functionality > available in class TYPE. > > Hmm, besides the definition of `$' there is another argument in favour of the address of the entity. If `$' yields the entity address then the object address can be obtained via C code *(void**)addr The other way around, obtaining the entity address from the object address is not possible. Thus, the entity address carries more information. The unreferencing might be done by a feature of TYPE, but how can the reverse operation be accomplished? I do not know ISE's INTERNAL class very well but I doubt that there is a function that yields the entity address of a given reference object: the best what the function can do is to return the address of the object (as function argument) on stack. This is quite meaningless after returning from the function. -- Wolfgang Jansen University of Potsdam, Germany mailto: wj...@so... |