|
Re: [TCS] TCSRuntime doitForContext ambiguity [message #12372 is a reply to message #12361] |
Mon, 21 April 2008 16:16 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) |
Frédéric Jouault![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=frederic.jouault%40univ-nantes.fr) Messages: 572 Registered: July 2009 |
Senior Member |
|
|
Hello,
> So this looks to me as if in case no suitable modelelement was found in
> the given context, you extend the search in the parent context.
>
> My problem with that is: How would you find ambiguous references this
> way? Meaning should there ever be two suitable candidates, on the
> current context and one in the parent context, should TCS not rather
> report a problem than taking the first candidate as reference?
The notion of context in TCS is related to the notion of scope.
There cannot be collisions within a given scope, but an element defined
at a local scope may mask what exists in any outer scope.
A typical example is the C language, in which global variables are
visible in functions, but functions can mask global variables with local
variables. In this case, the overwall C file is a context, and so are
functions. Moreover, C supports arbitrary nesting of scopes (each
statement block defines a new one).
If you want to make sure an element cannot be masked, then you may only
define one global context (i.e., the root of the model).
Regards,
Frédéric Jouault
|
|
|
Powered by
FUDForum. Page generated in 0.04342 seconds