Welcome, Guest
Username: Password: Remember me
  • Page:
  • 1

TOPIC: Default evaluation during default evaluation

Default evaluation during default evaluation 18 Feb 2004 12:58 #6643

Hi,

I have a question regarding default evaluation:

Suppose we are evaluating an alt statement and then run into the
evaluation of the active defaults. Now, one of these defaults has a
matching alternative, and in the body of this alternative there is a new
alt statement with no matching alternatives. Should, in this case,
default handling be triggered [more or less recursively] for this inner
alt stmt, or should this alt statement then block?

Example:

module ts {

type component CT {
timer g_t1;
timer g_t2;
}

altstep as() runs on CT {
[] g_t1.timeout {
alt {
[] g_t2.timeout { // <-- HERE
setverdict(pass);
}
}
}
}

testcase tc() runs on CT {
activate(as());

g_t1.start(2.0);
g_t2.start(10.0);

alt {
[] g_t2.timeout {
setverdict(fail);
}
}
}
}

In this example, what should happen when g_t2 has not yet expired and
the execution reaches the point marked '<-- HERE' while handling the
outer default as? Should as be re-entered as a new default on that level
(which, in turn, causes as to be re-entered on yet another level of
default handling, indefinitely until g_t2 finally expires [or infinitely
if g_t2 is not running?]

What should we do with such a situation?

a) Stick with this semantics, allowing the user to shoot himself in the
foot - after all, this is not the only way to crash a TTCN-3 test suite/

b) Treat default-handling during default-handling as a run time error
condition?

c) Switch off default handling during default handling, i.e., block at
the end of an alt statement that is encountered during default handling?

d) Use some modified form of default handling in the inner case?

I really don't know - I tend toward a) or c), but I would like to hear
other opinions and/or clarifications.

BR

Stephan

--
Stephan Tobies Sr. Research Engineer, Nokia Research Center
~ Mobile Networks Lab, Protocol Engineering Group
E-Mail: This email address is being protected from spambots. You need JavaScript enabled to view it.
Work Phone: +49-234-9842262
Mobile: +49-163-9842405
Fax: +49-234-9843491
Address: NRC Bochum, Meesmannstr. 103, 44807 Bochum, Germany
The administrator has disabled public write access.

Default evaluation during default evaluation 18 Feb 2004 13:22 #6644

Short answer: Yes, the default mechanism should be triggered for the
inner alt statement.

The intention is to treat all alt statements in the same manner, i.e.,
no exeception depending on where it is used.

In your case the inner alt statement is considered to be a new alt
statement, i.e., a new snapshot is taken and the alternative is
evaluated as the alternatives before. If no alternative matches, the
activated defaults will be taken into consideration.

Best regards
Jens

Stephan Tobies wrote:

> Hi,
>
> I have a question regarding default evaluation:
>
> Suppose we are evaluating an alt statement and then run into the
> evaluation of the active defaults. Now, one of these defaults has a
> matching alternative, and in the body of this alternative there is a new
> alt statement with no matching alternatives. Should, in this case,
> default handling be triggered [more or less recursively] for this inner
> alt stmt, or should this alt statement then block?
>
> Example:
>
> module ts {
>
> type component CT {
> timer g_t1;
> timer g_t2;
> }
>
> altstep as() runs on CT {
> [] g_t1.timeout {
> alt {
> [] g_t2.timeout { // <-- HERE
> setverdict(pass);
> }
> }
> }
> }
>
> testcase tc() runs on CT {
> activate(as());
>
> g_t1.start(2.0);
> g_t2.start(10.0);
>
> alt {
> [] g_t2.timeout {
> setverdict(fail);
> }
> }
> }
> }
>
> In this example, what should happen when g_t2 has not yet expired and
> the execution reaches the point marked '<-- HERE' while handling the
> outer default as? Should as be re-entered as a new default on that level
> (which, in turn, causes as to be re-entered on yet another level of
> default handling, indefinitely until g_t2 finally expires [or infinitely
> if g_t2 is not running?]
>
> What should we do with such a situation?
>
> a) Stick with this semantics, allowing the user to shoot himself in the
> foot - after all, this is not the only way to crash a TTCN-3 test suite/
>
> b) Treat default-handling during default-handling as a run time error
> condition?
>
> c) Switch off default handling during default handling, i.e., block at
> the end of an alt statement that is encountered during default handling?
>
> d) Use some modified form of default handling in the inner case?
>
> I really don't know - I tend toward a) or c), but I would like to hear
> other opinions and/or clarifications.
>
> BR
>
> Stephan
>
> --
> Stephan Tobies Sr. Research Engineer, Nokia Research Center
> ~ Mobile Networks Lab, Protocol Engineering Group
> E-Mail: This email address is being protected from spambots. You need JavaScript enabled to view it.
> Work Phone: +49-234-9842262
> Mobile: +49-163-9842405
> Fax: +49-234-9843491
> Address: NRC Bochum, Meesmannstr. 103, 44807 Bochum, Germany

--
======================================================================
Prof. Dr. Jens Grabowski
Institute for Informatics phone: +49 551 39 14690
University of Goettingen fax: +49 551 39 14415
Lotzestrasse 16-18
DE-37083 Göttingen This email address is being protected from spambots. You need JavaScript enabled to view it.
(Germany) www.swe.informatik.uni-goettingen.de
======================================================================
The administrator has disabled public write access.

Default evaluation during default evaluation 18 Feb 2004 13:29 #6645

Stephan,

The very first line of section 21.1 of [FEB-2003] edition of the standard
reads as follows: "The default mechanism is evoked at the end of each alt
statement" (what also implies macro expansions for standalone receiving
operations), and I do not recollect any clause in the standard that would
explicitly enforce suppression of default mechanism while the default
itself is being executed.

Given that, an assumption can be made that defaults can be attached
recursively, and it is the responsibility of test suite developer to
take this fact into account.

I do not see any infinite recursion exactly in your example. Timer
g_t1 will expire only once, so the timeout event for g_t1 will also
match only once. At the point marked as "HERE", when as() is attached
recursively second time as a default, "g_t1.timeout" will not match
second time, so we don't go any further. No recursion, no headaches.
Or am I wrong? Please correct me if so.

Hope this helps.

Alexey Mednonogov
Software Engineer

OpenTTCN Oy
www.openttcn.com/

Stephan Tobies wrote:

> Hi,
>
> I have a question regarding default evaluation:
>
> Suppose we are evaluating an alt statement and then run into the
> evaluation of the active defaults. Now, one of these defaults has a
> matching alternative, and in the body of this alternative there is a new
> alt statement with no matching alternatives. Should, in this case,
> default handling be triggered [more or less recursively] for this inner
> alt stmt, or should this alt statement then block?
>
> Example:
>
> module ts {
>
> type component CT {
> timer g_t1;
> timer g_t2;
> }
>
> altstep as() runs on CT {
> [] g_t1.timeout {
> alt {
> [] g_t2.timeout { // <-- HERE
> setverdict(pass);
> }
> }
> }
> }
>
> testcase tc() runs on CT {
> activate(as());
>
> g_t1.start(2.0);
> g_t2.start(10.0);
>
> alt {
> [] g_t2.timeout {
> setverdict(fail);
> }
> }
> }
> }
>
> In this example, what should happen when g_t2 has not yet expired and
> the execution reaches the point marked '<-- HERE' while handling the
> outer default as? Should as be re-entered as a new default on that level
> (which, in turn, causes as to be re-entered on yet another level of
> default handling, indefinitely until g_t2 finally expires [or infinitely
> if g_t2 is not running?]
>
> What should we do with such a situation?
>
> a) Stick with this semantics, allowing the user to shoot himself in the
> foot - after all, this is not the only way to crash a TTCN-3 test suite/
>
> b) Treat default-handling during default-handling as a run time error
> condition?
>
> c) Switch off default handling during default handling, i.e., block at
> the end of an alt statement that is encountered during default handling?
>
> d) Use some modified form of default handling in the inner case?
>
> I really don't know - I tend toward a) or c), but I would like to hear
> other opinions and/or clarifications.
>
> BR
>
> Stephan
>
> --
> Stephan Tobies Sr. Research Engineer, Nokia Research Center
> ~ Mobile Networks Lab, Protocol Engineering Group
> E-Mail: This email address is being protected from spambots. You need JavaScript enabled to view it.
> Work Phone: +49-234-9842262
> Mobile: +49-163-9842405
> Fax: +49-234-9843491
> Address: NRC Bochum, Meesmannstr. 103, 44807 Bochum, Germany
The administrator has disabled public write access.

Default evaluation during default evaluation 20 Feb 2004 19:12 #6648

In einer eMail vom 18/02/2004 13:24:08 GMT Standard Time schreibt
This email address is being protected from spambots. You need JavaScript enabled to view it.:

Hi Jens,

Just a thought:

Is there not then a problem (potential) with infinite recursion then?
That is why in TTCN-2 defaults were not allowed to have defaults.

Cheers,

Claude.

> Short answer: Yes, the default mechanism should be triggered for the
> inner alt statement.
>
> The intention is to treat all alt statements in the same manner, i.e.,
> no exeception depending on where it is used.
>
> In your case the inner alt statement is considered to be a new alt
> statement, i.e., a new snapshot is taken and the alternative is
> evaluated as the alternatives before. If no alternative matches, the
> activated defaults will be taken into consideration.
>



Claude Desroches email: This email address is being protected from spambots. You need JavaScript enabled to view it.
Solonplatz 3/2 phone: +49 30 9606 7986
13088 Berlin fax: +49 30 9606 7987

Germany
The administrator has disabled public write access.

Default evaluation during default evaluation 23 Feb 2004 09:46 #6649

Hi Claude,

the problem with infinite recursion in TTCN-2 is that the default
mechanism is defined as macro expansion mechanism, i.e., copying code as
new alternatives to levels of indentation. An infinite recursion than
means that you have to copy code infinitely often, which is impossible.

In TTCN-3 the default mechanism is more like a function call and
recursion in combination with function calls is not a compiler problem,
but a programming problem (infinite recursion might be a programming
error like an infinite loop and may be detected at runtime (e.g., stack
overflow)).

Best regards
Jens Grabowski

Claude Desroches wrote:

> In einer eMail vom 18/02/2004 13:24:08 GMT Standard Time schreibt
> This email address is being protected from spambots. You need JavaScript enabled to view it.:
>
> Hi Jens,
>
> Just a thought:
>
> Is there not then a problem (potential) with infinite recursion then?
> That is why in TTCN-2 defaults were not allowed to have defaults.
>
> Cheers,
>
> Claude.
>
>> Short answer: Yes, the default mechanism should be triggered for the
>> inner alt statement.
>>
>> The intention is to treat all alt statements in the same manner, i.e.,
>> no exeception depending on where it is used.
>>
>> In your case the inner alt statement is considered to be a new alt
>> statement, i.e., a new snapshot is taken and the alternative is
>> evaluated as the alternatives before. If no alternative matches, the
>> activated defaults will be taken into consideration.
>
>
>
>
>
> *Claude Desroches email: This email address is being protected from spambots. You need JavaScript enabled to view it.
> Solonplatz 3/2 phone: +49 30 9606 7986
> 13088 Berlin fax: +49 30 9606
> 7987
> Germany *

--
======================================================================
Prof. Dr. Jens Grabowski
Institute for Informatics phone: +49 551 39 14690
University of Goettingen fax: +49 551 39 14415
Lotzestrasse 16-18
DE-37083 Göttingen This email address is being protected from spambots. You need JavaScript enabled to view it.
(Germany) www.swe.informatik.uni-goettingen.de
======================================================================
The administrator has disabled public write access.
  • Page:
  • 1

FacebookTwitterGoogle BookmarksRedditNewsvineTechnoratiLinkedin