Results 11 -
19 of
19
Implementing continuation marks in JavaScript
- Proceedings of the 2008 ACM SIGPLAN Workshop on Scheme and Functional Programming
, 2008
"... MzScheme’s continuation marks provide a flexible mechanism for implementing a number of useful language features and tools. We demonstrate the simplicity and utility of continuation marks by adapting them for JavaScript as frame-based stack marks using the Rhino implementation, showing a simple mode ..."
Abstract
-
Cited by 3 (0 self)
- Add to MetaCart
MzScheme’s continuation marks provide a flexible mechanism for implementing a number of useful language features and tools. We demonstrate the simplicity and utility of continuation marks by adapting them for JavaScript as frame-based stack marks using the Rhino implementation, showing a simple model of their behavior, and using them to build a toy debugger. Along the way, we discover a few interesting things. First, it requires some thinking—but not much code—to add continuation marks to JavaScript. Second, coupling tail-calling with the “return” of statement-based languages leads to some interesting problems in formulating a semantics. Third, building a debugger based on continuation marks highlights (by its absence) the elegance of Scheme’s simple syntax and hygienic macro system. 1.
Directly reflective meta-programming
- Journal of Higher Order and Symbolic Computation
, 2008
"... Existing meta-programming languages operate on encodings of programs as data. This paper presents a new meta-programming language, based on an untyped lambda calculus, in which structurally reflective programming is supported directly, without any encoding. The language features call-by-value and ca ..."
Abstract
-
Cited by 2 (0 self)
- Add to MetaCart
Existing meta-programming languages operate on encodings of programs as data. This paper presents a new meta-programming language, based on an untyped lambda calculus, in which structurally reflective programming is supported directly, without any encoding. The language features call-by-value and call-by-name lambda abstractions, as well as novel reflective features enabling the intensional manipulation of arbitrary program terms. The language is scope safe, in the sense that variables can neither be captured nor escape their scopes. The expressiveness of the language is demonstrated by showing how to implement quotation and evaluation operations, as proposed by Wand. The language’s utility for meta-programming is further demonstrated through additional representative examples. A prototype implementation is described and evaluated.
Dynamic rebinding for marshalling and update, via redex-time and destruct-time reduction
, 2008
"... ..."
Monads in Action
"... In functional programming, monadic characterizations of computational effects are normally understood denotationally: they describe how an effectful program can be systematically expanded or translated into a larger, pure program, which can then be evaluated according to an effect-free semantics. An ..."
Abstract
-
Cited by 1 (0 self)
- Add to MetaCart
In functional programming, monadic characterizations of computational effects are normally understood denotationally: they describe how an effectful program can be systematically expanded or translated into a larger, pure program, which can then be evaluated according to an effect-free semantics. Any effect-specific operations expressible in the monad are also given purely functional definitions, but these definitions are only directly executable in the context of an already translated program. This approach thus takes an inherently Church-style view of effects: the nominal meaning of every effectful term in the program depends crucially on its type. We present here a complementary, operational view of monadic effects, in which an effect definition directly induces an imperative behavior of the new operations expressible in the monad. This behavior is formalized as additional operational rules for only the new constructs; it does not require any structural changes to the evaluation judgment. Specifically, we give a small-step operational semantics of a prototypical functional language supporting programmer-definable, layered effects, and show how this semantics naturally supports reasoning by familiar syntactic techniques, such as showing soundness of a Curry-style effect-type system by the progress+preservation method.
Advanced Programming Techniques Using Scheme
, 1998
"... this paper, we describe an interactive reducer for lambda terms that combines first-class continuations, macros, delay, and state. We also describe the means by which we induce students to master advanced topics. 1. Introduction ..."
Abstract
- Add to MetaCart
this paper, we describe an interactive reducer for lambda terms that combines first-class continuations, macros, delay, and state. We also describe the means by which we induce students to master advanced topics. 1. Introduction
How should context-escaping closures proceed?
"... Context-oriented programming treats execution context explicitly and provides means for context-dependent adaptation at runtime. This is achieved, for example, using dynamic layer activation and contextual dispatch, where the context consists of a layer environment of a stack of active layers. Layer ..."
Abstract
- Add to MetaCart
Context-oriented programming treats execution context explicitly and provides means for context-dependent adaptation at runtime. This is achieved, for example, using dynamic layer activation and contextual dispatch, where the context consists of a layer environment of a stack of active layers. Layers can adapt existing behaviour using proceed to access earlier activated layers. A problem arises when a call to proceed is made from within a closure that escapes the layer environment in which it was defined. It is not clear how to interpret proceed when the closure is subsequently applied in a different environment, because the layers it implicitly refers to (such as the original layer and/or the remaining layers) may no longer be active. In this paper, we describe this problem in detail and present some approaches for dealing with it, though ultimately we leave the question open. 1.
Design, Languages
"... It is often hard to write programs that are efficient yet reusable. For example, an efficient implementation of Gaussian elimination should be specialized to the structure and known static properties of the input matrix. The most profitable optimizations, such as choosing the best pivoting or memoiz ..."
Abstract
- Add to MetaCart
It is often hard to write programs that are efficient yet reusable. For example, an efficient implementation of Gaussian elimination should be specialized to the structure and known static properties of the input matrix. The most profitable optimizations, such as choosing the best pivoting or memoization, cannot be expected of even an advanced compiler because they are specific to the domain, but expressing these optimizations directly makes for ungainly source code. Instead, a promising and popular way to reconcile efficiency with reusability is for a domain expert to write code generators. Two pillars of this approach are types and effects. Typed multilevel languages such as MetaOCaml ensure safety: a well-typed code generator neither goes wrong nor generates code that goes wrong. Side effects such as state and control ease correctness: an effectful generator can resemble the textbook presentation of an algorithm, as is familiar to domain experts, yet insert let for memoization and if for bounds-checking, as is necessary for efficiency. However, adding effects blindly renders multilevel types unsound. We introduce the first two-level calculus with control effects and a sound type system. We give small-step operational semantics as well as a continuation-passing style (CPS) translation. For soundness, our calculus restricts the code generator’s effects to the scope of generated binders. Even with this restriction, we can finally write efficient code generators for dynamic programming and numerical methods in direct style, like in algorithm textbooks, rather than in CPS or monadic style.
Intersection types for unbind and rebind (Extended Abstract) ∗
"... We define a type system with intersection types for an extension of lambda-calculus with unbind and rebind operators. In this calculus, a term t with free variables x1,...,xn, representing open code, can be packed into an unbound term 〈 x1,...,xn | t 〉, and passed around as a value. In order to exec ..."
Abstract
- Add to MetaCart
We define a type system with intersection types for an extension of lambda-calculus with unbind and rebind operators. In this calculus, a term t with free variables x1,...,xn, representing open code, can be packed into an unbound term 〈 x1,...,xn | t 〉, and passed around as a value. In order to execute inside code, an unbound term should be explicitly rebound at the point where it is used. Unbinding and rebinding are hierarchical, that is, the term t can contain arbitrarily nested unbound terms, whose inside code can only be executed after a sequence of rebinds has been applied. Correspondingly, types are decorated with levels, and a term has type τ k if it needs k rebinds in order to reduce to a value of type τ. With intersection types we model the fact that a term can be used differently in contexts providing a different numbers of unbinds. In particular, top-level terms, that is, terms not requiring unbinds to reduce to values, should have a value type, that is, an intersection type where at least one element has level 0. With the proposed intersection type system we get soundness under the call-by-value strategy, an issue which was not resolved by previous type systems.
Theoretical Informatics and Applications Informatique Théorique et Applications Will be set by the publisher EXTENDING LAMBDA-CALCULUS WITH UNBIND AND REBIND
"... Abstract. We extend the simply typed λ-calculus with unbind and rebind primitive constructs. That is, a value can be a fragment of open code, which in order to be used should be explicitly rebound. This mechanism nicely coexists with standard static binding. The motivation is to provide an unifying ..."
Abstract
- Add to MetaCart
Abstract. We extend the simply typed λ-calculus with unbind and rebind primitive constructs. That is, a value can be a fragment of open code, which in order to be used should be explicitly rebound. This mechanism nicely coexists with standard static binding. The motivation is to provide an unifying foundation for mechanisms of dynamic scoping, where the meaning of a name is determined at runtime, rebinding, such as dynamic updating of resources and exchange of mobile code, and delegation, where an alternative action is taken if a binding is missing. Depending on the application scenario, we consider two extensions which differ in the way type safety is guaranteed. The former relies on a combination of static and dynamic type checking. That is, rebind raises a dynamic error if for some variable there is no replacing term or it has the wrong type. In the latter, this error is prevented by a purely static type system, at the price of more sophisticated types. 1991 Mathematics Subject Classification. 68N15, 68N18.

