## Assignment 7 Tests for Task 3

Moderator: Konzepte der Programmiersprachen

Kabooom
Erstie
Beiträge: 19
Registriert: 17. Jun 2017 15:04

### Assignment 7 Tests for Task 3

Hello,

i was looking at the tests for Task 3 and i have two questions:

- Shouldn't the expression in this test evaluate to true?

Code: Alles auswählen

test("10") { assertResult(BoolV(false))
{ runInterp(And(true, BindCC('k, Or(true, App('k, false))))) }}
- Shouldn't the expression in this test evaluate to false?

Code: Alles auswählen

test("16") { assertResult(BoolV(true))
{ runInterp(And(true, BindCC('k, Let('f, Fun('v, And('v, App('k, true))), App('f, false))))) }}

mirko-koehler
Moderator
Beiträge: 82
Registriert: 16. Okt 2017 12:28

### Re: Assignment 7 Tests for Task 3

Hi,

The continuations in task 3 are of type Value => Nothing. That means that these continuations never return, i.e. once the continuation is called there is no coming back!
In order to return something from a continuation, we throw an exception that contains the return value, see EndOfWorldException in the test cases. In test 10, calling the continuation should execute the rest of the program when the continuation was bound and never return, i.e. the And is executed and the continuation never returns to the Or. The same holds for test 16.

Note that this is different from "delimited continuations" that have been introduced with reset and shift in the lecture. These continuations return a value.