  

<table class="width100" style="width:100%;" data-cellspacing="1">
<colgroup>
<col style="width: 16%" />
<col style="width: 16%" />
<col style="width: 16%" />
<col style="width: 16%" />
<col style="width: 16%" />
<col style="width: 16%" />
</colgroup>
<tbody>
<tr class="odd">
<td colspan="6" class="form-title"><div class="center">
ETSI's Bug Tracker - Ext Pack: Behaviour Types (ES 202 785)
</div></td>
</tr>
<tr class="even">
<td colspan="6" class="form-title">View Issue Details</td>
</tr>
<tr class="odd">
<td colspan="6" class="print-spacer"><hr /></td>
</tr>
<tr class="even print-category">
<td class="print" width="16%">ID</td>
<td class="print" width="16%">Project</td>
<td class="print" width="16%">Category</td>
<td class="print" width="16%">View Status</td>
<td class="print" width="16%">Date Submitted</td>
<td class="print" width="16%">Last Update</td>
</tr>
<tr class="odd print">
<td class="print">0008188</td>
<td class="print">Ext Pack: Behaviour Types (ES 202 785)</td>
<td class="print">New Feature</td>
<td class="print">public</td>
<td class="print">11-01-2023 12:57</td>
<td class="print">16-12-2024 13:25</td>
</tr>
<tr class="even">
<td colspan="6" class="print-spacer"><hr /></td>
</tr>
<tr class="odd print">
<td class="print-category">Reporter</td>
<td class="print">Matthias Simon</td>
<td colspan="4" class="print"> </td>
</tr>
<tr class="even print">
<td class="print-category">Assigned To</td>
<td class="print">Gusztáv Adamis</td>
<td colspan="4" class="print"> </td>
</tr>
<tr class="odd print">
<td class="print-category">Priority</td>
<td class="print">normal</td>
<td class="print-category">Severity</td>
<td class="print">minor</td>
<td class="print-category">Reproducibility</td>
<td class="print">have not tried</td>
</tr>
<tr class="even print">
<td class="print-category">Status</td>
<td class="print">resolved</td>
<td class="print-category">Resolution</td>
<td class="print">fixed</td>
<td colspan="2" class="print"> </td>
</tr>
<tr class="odd print">
<td class="print-category">Platform</td>
<td class="print"></td>
<td class="print-category">OS</td>
<td class="print"></td>
<td class="print-category">OS Version</td>
<td class="print"></td>
</tr>
<tr class="even print">
<td class="print-category">Product Version</td>
<td class="print"></td>
<td colspan="4" class="print"> </td>
</tr>
<tr class="odd">
<td class="print-category">Target Version</td>
<td class="print"></td>
<td class="print-category">Fixed in Version</td>
<td class="print"></td>
<td colspan="2" class="print"> </td>
</tr>
<tr class="even print">
<td class="print-category">Clause Reference(s)</td>
<td colspan="4" class="print">n/a</td>
<td></td>
</tr>
<tr class="odd print">
<td class="print-category">Source (company - Author)</td>
<td colspan="4" class="print">Nokia - Matthias Simon</td>
<td></td>
</tr>
<tr class="even">
<td colspan="6" class="print-spacer"><hr /></td>
</tr>
<tr class="odd print">
<td class="print-category">Summary</td>
<td colspan="5" class="print">0008188: Support for function
literals</td>
</tr>
<tr class="even print">
<td class="print-category">Description</td>
<td colspan="5" class="print">A function literal, also known as lambda
function or anonymous function, is a function definition without name.
Example:<br />
<br />
    var fn := function (integer x) return boolean { return x mod 2 == 0
}<br />
    apply(fn(23));</td>
</tr>
<tr class="odd print">
<td class="print-category">Steps To Reproduce</td>
<td colspan="5" class="print"></td>
</tr>
<tr class="even print">
<td class="print-category">Additional Information</td>
<td colspan="5" class="print"></td>
</tr>
<tr class="odd print">
<td class="print-category">Tags</td>
<td colspan="5" class="print">No tags attached.</td>
</tr>
<tr class="even print">
<td class="print-category">Relationships</td>
<td colspan="5" class="print"></td>
</tr>
<tr class="odd print">
<td class="print-category">Attached Files</td>
<td colspan="5" class="print"></td>
</tr>
<tr class="even">
<td colspan="6" class="print-spacer"><hr /></td>
</tr>
<tr class="odd">
<td class="form-title">Issue History</td>
<td></td>
<td></td>
<td></td>
<td></td>
<td></td>
</tr>
<tr class="even print-category">
<td class="row-category-history">Date Modified</td>
<td class="row-category-history">Username</td>
<td class="row-category-history">Field</td>
<td class="row-category-history">Change</td>
<td></td>
<td></td>
</tr>
<tr class="odd print">
<td class="print">11-01-2023 12:57</td>
<td class="print"><a
href="http://oldforge.etsi.org/mantis/view_user_page.php?id=1237">Matthias
Simon</a></td>
<td class="print">New Issue</td>
<td class="print"></td>
<td></td>
<td></td>
</tr>
<tr class="even print">
<td class="print">05-09-2023 11:06</td>
<td class="print"><a
href="http://oldforge.etsi.org/mantis/view_user_page.php?id=82">Jens
Grabowski</a></td>
<td class="print">Note Added: 0016522</td>
<td class="print"></td>
<td></td>
<td></td>
</tr>
<tr class="odd print">
<td class="print">05-09-2023 11:07</td>
<td class="print"><a
href="http://oldforge.etsi.org/mantis/view_user_page.php?id=82">Jens
Grabowski</a></td>
<td class="print">Assigned To</td>
<td class="print">=&gt; Matthias Simon</td>
<td></td>
<td></td>
</tr>
<tr class="even print">
<td class="print">05-09-2023 11:07</td>
<td class="print"><a
href="http://oldforge.etsi.org/mantis/view_user_page.php?id=82">Jens
Grabowski</a></td>
<td class="print">Status</td>
<td class="print">new =&gt; assigned</td>
<td></td>
<td></td>
</tr>
<tr class="odd print">
<td class="print">08-11-2023 12:35</td>
<td class="print"><a
href="http://oldforge.etsi.org/mantis/view_user_page.php?id=1237">Matthias
Simon</a></td>
<td class="print">Note Added: 0016549</td>
<td class="print"></td>
<td></td>
<td></td>
</tr>
<tr class="even print">
<td class="print">08-11-2023 13:54</td>
<td class="print"><a
href="http://oldforge.etsi.org/mantis/view_user_page.php?id=82">Jens
Grabowski</a></td>
<td class="print">Assigned To</td>
<td class="print">Matthias Simon =&gt; Jens Grabowski</td>
<td></td>
<td></td>
</tr>
<tr class="odd print">
<td class="print">08-11-2023 13:54</td>
<td class="print"><a
href="http://oldforge.etsi.org/mantis/view_user_page.php?id=82">Jens
Grabowski</a></td>
<td class="print">Assigned To</td>
<td class="print">Jens Grabowski =&gt; Matthias Simon</td>
<td></td>
<td></td>
</tr>
<tr class="even print">
<td class="print">08-11-2023 13:54</td>
<td class="print"><a
href="http://oldforge.etsi.org/mantis/view_user_page.php?id=82">Jens
Grabowski</a></td>
<td class="print">Assigned To</td>
<td class="print">Matthias Simon =&gt; Gusztáv Adamis</td>
<td></td>
<td></td>
</tr>
<tr class="odd print">
<td class="print">09-11-2023 20:52</td>
<td class="print"><a
href="http://oldforge.etsi.org/mantis/view_user_page.php?id=783">Gusztáv
Adamis</a></td>
<td class="print">Note Added: 0016569</td>
<td class="print"></td>
<td></td>
<td></td>
</tr>
<tr class="even print">
<td class="print">26-01-2024 16:28</td>
<td class="print"><a
href="http://oldforge.etsi.org/mantis/view_user_page.php?id=769">Olivier
Genoud</a></td>
<td class="print">Note Added: 0016610</td>
<td class="print"></td>
<td></td>
<td></td>
</tr>
<tr class="odd print">
<td class="print">16-12-2024 13:25</td>
<td class="print"><a
href="http://oldforge.etsi.org/mantis/view_user_page.php?id=82">Jens
Grabowski</a></td>
<td class="print">Note Added: 0016732</td>
<td class="print"></td>
<td></td>
<td></td>
</tr>
<tr class="even print">
<td class="print">16-12-2024 13:25</td>
<td class="print"><a
href="http://oldforge.etsi.org/mantis/view_user_page.php?id=82">Jens
Grabowski</a></td>
<td class="print">Status</td>
<td class="print">assigned =&gt; resolved</td>
<td></td>
<td></td>
</tr>
<tr class="odd print">
<td class="print">16-12-2024 13:25</td>
<td class="print"><a
href="http://oldforge.etsi.org/mantis/view_user_page.php?id=82">Jens
Grabowski</a></td>
<td class="print">Resolution</td>
<td class="print">open =&gt; fixed</td>
<td></td>
<td></td>
</tr>
</tbody>
</table>

  

<table class="width100" data-cellspacing="1">
<colgroup>
<col style="width: 50%" />
<col style="width: 50%" />
</colgroup>
<tbody>
<tr class="odd">
<td colspan="2" class="form-title">Notes</td>
</tr>
<tr class="even">
<td colspan="2" class="print-spacer"><hr /></td>
</tr>
<tr class="odd">
<td class="nopad" data-valign="top" width="20%"><table class="hide"
data-cellspacing="1">
<tbody>
<tr class="odd">
<td class="print">(0016522)</td>
</tr>
<tr class="even">
<td class="print"><a
href="http://oldforge.etsi.org/mantis/view_user_page.php?id=82">Jens
Grabowski</a>   </td>
</tr>
<tr class="odd">
<td class="print">05-09-2023 11:06   </td>
</tr>
</tbody>
</table></td>
<td class="nopad" data-valign="top" width="85%"><table class="hide"
data-cellspacing="1">
<tbody>
<tr class="odd">
<td class="print">TTF discussion: More elaborated example needed.</td>
</tr>
</tbody>
</table></td>
</tr>
<tr class="even">
<td colspan="2" class="print-spacer"><hr /></td>
</tr>
<tr class="odd">
<td class="nopad" data-valign="top" width="20%"><table class="hide"
data-cellspacing="1">
<tbody>
<tr class="odd">
<td class="print">(0016549)</td>
</tr>
<tr class="even">
<td class="print"><a
href="http://oldforge.etsi.org/mantis/view_user_page.php?id=1237">Matthias
Simon</a>   </td>
</tr>
<tr class="odd">
<td class="print">08-11-2023 12:35   </td>
</tr>
</tbody>
</table></td>
<td class="nopad" data-valign="top" width="85%"><table class="hide"
data-cellspacing="1">
<colgroup>
<col style="width: 100%" />
</colgroup>
<tbody>
<tr class="odd">
<td class="print">Function literals are evaluated lazily and capture
their context. This makes implementation of deferred functions feasible.
For example:<br />
 <br />
<br />
    type function CancelFunc();<br />
<br />
    testcase Example() runs on MTC {<br />
        // start fixtures<br />
        var cancel := SetupDatabase();<br />
<br />
        // do some testing<br />
<br />
        // handle graceful shutdown<br />
        cancel();<br />
    }<br />
<br />
    function SetupDatabase() return CancelFunc<br />
    {<br />
        var db := DatabaseComponent.create;<br />
        db.start(listen());<br />
        return function() {<br />
            db.stop; // Captures db and allows to call methods,
locally<br />
        }<br />
    }<br />
<br />
<br />
Another use-case is parametrizing callbacks:<br />
<br />
    module Service<br />
    {<br />
        type component Component { /* ... */ }<br />
<br />
        function Start(in ExitFunc ef := withSuccess) return
Component<br />
        {<br />
            var c := Component.create;<br />
            c.start(mainLoop(ef));<br />
            return c;<br />
        }<br />
<br />
        private function mainLoop(ExitFunc ef) runs on Component {<br />
            p.receive(ProcessState:{started := ?});<br />
            log("Service is up and running");<br />
<br />
            var ExitCode ec;<br />
            p.receive(ProcessState:{exited := ?}) -&gt; value ec;<br />
            f(ec);<br />
        }<br />
<br />
        type function ExitFunc(ExitCode ec) runs on Component;<br />
<br />
        type enumerated ExitCode {<br />
            SUCCESS(0),<br />
            ERROR(1..127),<br />
            SIGTERM(-15),<br />
            SIGKILL(-9),<br />
        }<br />
<br />
        group helpers<br />
        {<br />
            function withSuccess(in ExitCode ec) runs on Component
{<br />
                if (ec != SUCCESS) {<br />
                    setverdict(fail, "want=0, got=" &amp; ec);<br />
                    stop;<br />
                }<br />
            }<br />
<br />
            function withError(in ExitCode ec) runs on Component {<br />
                if (ec != ERROR) {<br />
                    setverdict(fail, "want!=0, got=" &amp; ec);<br />
                    stop;<br />
                }<br />
            }<br />
<br />
            function withSignal(in ExitCode sig) return ExitFunc<br />
            {<br />
                return function(in ExitCode ec) runs on Component
{<br />
                    if (ec != sig) {<br />
                        setverdict(fail, "want=" &amp; sig, got=" &amp;
ec);<br />
                        stop;<br />
                    }<br />
                }<br />
            }<br />
<br />
            function withTimeout(in float duration) return
ExitFunc<br />
            {<br />
                return function(in ExitCode ec) runs on Component
{<br />
                    // ...<br />
                }<br />
        }<br />
    }<br />
<br />
    module Example<br />
    {<br />
        testcase SunnyDay()<br />
        {<br />
            var service1 := Service.Start();<br />
            var service2 := Service.Start(Service.withError);<br />
<br />
            // do some API testing...<br />
<br />
            all components.done;<br />
        }<br />
<br />
<br />
        testcase ResilianceTest_ServiceCrashes()<br />
        {<br />
            var service1 :=
Service.Start(Service.withSignal(Service.SIGTERM));<br />
            var service2 :=
Service.Start(Service.withTimeout(60.0));<br />
<br />
            // do some API testing...<br />
<br />
            all components.done;<br />
        }<br />
<br />
    }</td>
</tr>
</tbody>
</table></td>
</tr>
<tr class="even">
<td colspan="2" class="print-spacer"><hr /></td>
</tr>
<tr class="odd">
<td class="nopad" data-valign="top" width="20%"><table class="hide"
data-cellspacing="1">
<tbody>
<tr class="odd">
<td class="print">(0016569)</td>
</tr>
<tr class="even">
<td class="print"><a
href="http://oldforge.etsi.org/mantis/view_user_page.php?id=783">Gusztáv
Adamis</a>   </td>
</tr>
<tr class="odd">
<td class="print">09-11-2023 20:52   </td>
</tr>
</tbody>
</table></td>
<td class="nopad" data-valign="top" width="85%"><table class="hide"
data-cellspacing="1">
<tbody>
<tr class="odd">
<td class="print">The problems in examples can be solved with the
existing TTCN-3 instructions.</td>
</tr>
</tbody>
</table></td>
</tr>
<tr class="even">
<td colspan="2" class="print-spacer"><hr /></td>
</tr>
<tr class="odd">
<td class="nopad" data-valign="top" width="20%"><table class="hide"
data-cellspacing="1">
<tbody>
<tr class="odd">
<td class="print">(0016610)</td>
</tr>
<tr class="even">
<td class="print"><a
href="http://oldforge.etsi.org/mantis/view_user_page.php?id=769">Olivier
Genoud</a>   </td>
</tr>
<tr class="odd">
<td class="print">26-01-2024 16:28   </td>
</tr>
</tbody>
</table></td>
<td class="nopad" data-valign="top" width="85%"><table class="hide"
data-cellspacing="1">
<tbody>
<tr class="odd">
<td class="print">We assume/expect that this CR will not become part of
the core language but will become part of an extension or be added to an
extension (e.g. OO extension).</td>
</tr>
</tbody>
</table></td>
</tr>
<tr class="even">
<td colspan="2" class="print-spacer"><hr /></td>
</tr>
<tr class="odd">
<td class="nopad" data-valign="top" width="20%"><table class="hide"
data-cellspacing="1">
<tbody>
<tr class="odd">
<td class="print">(0016732)</td>
</tr>
<tr class="even">
<td class="print"><a
href="http://oldforge.etsi.org/mantis/view_user_page.php?id=82">Jens
Grabowski</a>   </td>
</tr>
<tr class="odd">
<td class="print">16-12-2024 13:25   </td>
</tr>
</tbody>
</table></td>
<td class="nopad" data-valign="top" width="85%"><table class="hide"
data-cellspacing="1">
<tbody>
<tr class="odd">
<td class="print">Discussion continues in Gitlab.</td>
</tr>
</tbody>
</table></td>
</tr>
</tbody>
</table>
