Linearity and laziness

نویسنده

  • David Wakeling
چکیده

A criticism often levelled at functional languages is that they do not cope elegantly or eeciently with problems involving changes of state. In a recent paper 26], Wadler has proposed a new approach to these problems. His proposal involves the use of a type system based on the linear logic of Girard 7]. This allows the programmer to specify the \natural" imperative operations without at the same time sacriicing the crucial property of referential transparency. In this paper we investigate the practicality of Wadler's approach, describing the design and implementation of a variant of Lazy ML 2]. A small example program shows how imperative operations can be used in a referentially transparent way, and at the same time it highlights some of the problems with the approach. Our implementation is based on a variant of the G-machine 15, 1]. We give some benchmark gures to compare the performance of our machine with the original one. The results are disappointing: the cost of maintaining linearity in terms of lost optimisations at compile-time, and the extra data structures that must be created at run-time more than cancels out the gains made by using linear types to reduce the amount of garbage collection. We also consider how the language and the implementation can be extended to accommodate aggregates such as arrays. Here the results are more promising: linear arrays are usually more eecient than trailered ones, but they are less eecient than destructively-updated ones. We conclude that larger aggregates are the most promising area of application for Wadler's type system.

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

The mediating role of organizational culture in the effect of organizational laziness on the inertia and organizational performance of the Ministry of Sports and Youth

Abstract Introduction: The main purpose of this study was to investigate the mediating role of organizational culture in the effect of laziness on organizational performance and inertia. Methods:  This study was one of the series of correlational descriptive research that was conducted in the field. The statistical population consisted of all the employees of the country's Ministry of Sports an...

متن کامل

Title: Examine Your Laziness. a Lightweight Procedural Debugging Technique for Haskell Examine Your Laziness. a Lightweight Procedural Debugging Technique for Haskell

Writing debuggers for lazy functional languages is known to be difficult. While some recent progress has been made in this area, there is a dearth of practical tools which are applicable to real programs. We present a lightweight approach to procedural debugging, based on the traditional “stop-examine-continue” model using breakpoints. Our debugger sidesteps most of the problematic issues with ...

متن کامل

The Impact of Laziness on Parallelism and the Limits of StrictnessAnalysisG

The major question examined by this paper is whether suucient ne-grain parallelism can be obtained from programs written in a lazy functional language. To answer this question, we have implemented a prototype compiler based on a novel approach to strictness analysis (called abstract demand propagation) and we have compared this implementation strategy (optimized lazy) with other implementations...

متن کامل

The Impact of Laziness on Parallelism and the Limits of Strictness Analysis

The major question examined by this paper is whether suucient ne-grain parallelism can be obtained from programs written in a lazy functional language. To answer this question, we have implemented a prototype compiler based on a novel approach to strictness analysis (called abstract demand propagation) and we have compared this implementation strategy (optimized lazy) with other implementations...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 1990