Title:

The structure of callbyvalue

Understanding procedure calls is crucial in computer science and everyday programming. Among the most common strategies for passing procedure arguments ('evaluation strategies') are 'callbyname', 'callbyneed', and 'callbyvalue', where the latter is the most commonly used. While reasoning about procedure calls is simple for callbyname, problems arise for callbyneed and callbyvalue, because it matters how often and in which order the arguments of a procedure are evaluated. We shall classify these problems and see that all of them occur for callbyvalue, some occur for callbyneed, and none occur for callbyname. In that sense, callbyvalue is the 'greatest common denominator' of the three evaluation strategies. Reasoning about callbyvalue programs has been tackled by Eugenio Moggi's 'computational lambdacalculus', which is based on a distinction between 'values' and arbitrary expressions. However, the computational lambdacalculus deals only implicitly with the evaluation order and the number of evaluations of procedure arguments. Therefore, certain program equivalences that we should be able to spot immediately require long proofs. We shall remedy this by introducing a new calculus  the 'letcalculus'  that deals explicitly with evaluation order and the number of evaluations. For dealing with the number of evaluations, the letcalculus has mechanisms known from; linear, affine, and relevant logic. For dealing with evaluation order, it has mechanisms which seems to be completely new. We shall also introduce a new kind of denotational semantics for callbyvalue programming languages. The key idea is to consider how categories with finite products are commonly used to model callbyname languages, and remove the axioms which break for callbyvalue. The resulting models we shall call 'precartesian categories'. These relatively simple structures have remarkable mathematical properties, which will inspire the design of the letcalculus. Precartesian categories will provide a semantics of both the letcalculus and the computational lambdacalculus. This semantics not only validates the same program equivalences as Moggi's monadbased semantics of the computational lambdacalculus; It is also 'direct' by contrast to Moggi's semantics, which implicitly performs a language transform. Our direct semantics has practical benefits: It clarifies issues that are related with the evaluation order and the number of evaluations of procedure arguments, and it is also very easy to remember. The thesis is rounded up by three applications of the letcalculus and precartesian categories: First, construing wellestablished models of partiality (i.e. categories of generalised partial functions) as precartesian categories, and specialising the letcalculus accordingly. Second, adding global state to a given computational system and construing the resulting system as a precartesian category. Third, analysing an implementation technique called 'continuationstyle transform' by construing the source language of such a transform as a precartesian category.
