Re: Type of Expression
Eric Bezault <ericb-D6Qt/9opevxWk0Htik3J/[email protected]>
| Newsgroups | gmane.comp.lang.eiffel.gobo.general |
|---|---|
| Organization | Gobo |
| Message-ID | <[email protected]> |
Bernd Schoeller wrote:
> Hi,
>
> is there a standard way to calculate the type of an ET_EXPRESSION
> within the gobo eiffel tools, assuming that I have already compiled
> the system?
There is no such thing as ET_EXPRESSION.type because the type of
the expression depends on the context. For example if we have:
class A
feature
f is
do
print (foo.bar)
end
foo: X
end
class B
inherit
A
redefine
foo
end
feature
foo: Y
end
class X
feature
bar: ANY
end
class Y
inherit
X
redefine
bar
end
feature
bar: STRING
end
The expression 'foo.bar' will have type ANY in the context of
class A, but type STRING in the context of class B. Perhaps
there is a way to have a function in ET_EXPRESSION which would
take a context as argument and would compute the type in that
context. I didn't do it though because it was deemed too
expensive for my needs. If you really need it I can dive into
that code again and see what I can do.
Another alternative is to run the dynamic type set builder
(used to detect CAT-calls) and then do something like that:
a_feature.dynamic_type_set (my_expression).static_type.base_type
where `a_feature' is an ET_DYNAMIC_FEATURE (computed by the
dynamic type set builder) and `my_expression' is an ET_EXPRESSION
which appears in the corresponding feature. But in your case
running the dynamic type set builder might be even more expensive.
--
Eric Bezault
mailto:ericb-D6Qt/9opevxWk0Htik3J/[email protected]
http://www.gobosoft.com
To Post a message, send it to: [email protected]
To Unsubscribe, send a blank message to: [email protected]
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/gobo-eiffel/
<*> To unsubscribe from this group, send an email to:
[email protected]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/