266 research outputs found

    The C++0x "Concepts" Effort

    Full text link
    C++0x is the working title for the revision of the ISO standard of the C++ programming language that was originally planned for release in 2009 but that was delayed to 2011. The largest language extension in C++0x was "concepts", that is, a collection of features for constraining template parameters. In September of 2008, the C++ standards committee voted the concepts extension into C++0x, but then in July of 2009, the committee voted the concepts extension back out of C++0x. This article is my account of the technical challenges and debates within the "concepts" effort in the years 2003 to 2009. To provide some background, the article also describes the design space for constrained parametric polymorphism, or what is colloquially know as constrained generics. While this article is meant to be generally accessible, the writing is aimed toward readers with background in functional programming and programming language theory. This article grew out of a lecture at the Spring School on Generic and Indexed Programming at the University of Oxford, March 2010

    Type-based termination of recursive definitions and constructor subtyping in typed lambda calculi

    Get PDF
    Tese de doutoramento em Informática, ramo de Fundamentos da Computação.In type systems, a combination of subtyping and overloading is a way to achieve more precise typings. This thesis explores how to use these mechanisms in two directions: (i) as a way to ensure termination of recursive functions; (ii) as a way to capture in a type-theoretic context the use of subtyping as inclusion between inductively defined sets. The first part of the thesis presents a mechanism that ensures termination through types and defines a system that incorporates it. More precisely, we formalize the notion of type-based termination using a restricted form of type dependency (also known as indexed types). Every datatype is replaced by a family of approximations indexed over a set of stages; then being in a certain approximation means that a term can be seen as having a certain bound on constructor usage. We introduce λˆ, a simply typed λ-calculus à la Curry, supporting parametric inductive datatypes, case-expressions and letrec-expressions with termination ensured by types. We show that λˆ enjoys important meta-theoretical properties, including confluence, subject reduction and strong normalization. We also show that the calculus is powerful enough to encode many recursive definitions rejected by existing type systems, and give some examples. We prove that this system encompasses in a strict way Giménez' λς, a system in which termination of typable expressions is ensured by a syntactical condition constraining the uses of recursive calls in the body of definitions. The second part of the thesis studies properties of a type system featuring constructor subtyping. Constructor subtyping is a form of subtyping in which an inductive type σ is viewed as a subtype of another inductive type τ if each constructor c of σ is also a constructor of τ (but τ may have more constructors), and whenever c : θ'→σ is a declaration for τ, then c : θ'→τ is a declaration for τ with θ'→≤θ'. In this thesis we allow for this form of subtyping in the system λcs, which is a simply typed λ-calculus à la Curry, supporting mutually recursive parametric datatypes, case-expressions and letrec-expressions. We establish the properties of confluence, subject reduction and decidability of type checking for this calculus. As the system features general recursion, the reduction calculus is obviously non-terminating. However, we sketch two ways of achieving strong normalization. One way is to constrain the system to guard-by-destructors recursion, following what is done for λς. The other way is to enrich the type system with stages (following the ideas presented for λˆ) and enforcing termination through typing. Potential uses of constructor subtyping include proof assistants and functional programming languages. In particular, constructor subtyping provides a suitable foundation for extensible datatypes, and is specially adequate to re-usability. The combination of subtyping between datatypes and overloading of constructors allows the definition of new datatypes by restricting or by expanding the set of constructors of an already defined datatype. This flexibility in the definition of datatypes induces a convenient form of code reuse for recursive functions, allowing the definition of new functions by restricting or by expanding already defined ones. We enrich a calculus featuring constructor subtyping with a mechanism to define extensible overloaded recursive functions by pattern-matching, obtaining the system λcs+fun. We formalize the concept of well-formed environment of function declarations and establish that under such environments the properties of confluence, subject reduction and decidability of type-checking hold. Moreover, we prove that the requirements imposed for the well-formed environments are decidable and show how standard techniques can still be used for compiling pattern-matching into case-expressions.Em sistemas de tipos, a combinação de mecanismos de subtipagem e de sobrecarga de construtores permite alcançar tipagens mais precisas para os termos. Esta tese investiga a utilização destes mecanismos, quer como forma de assegurar a terminação de funções recursivas, quer como forma de captar subtipagem através de inclusão de conjuntos num sistema com tipos indutivos. A primeira parte da tese apresenta um sistema de tipos capaz de assegurar a terminação de funções recursivas, unicamente por tipagem. Mais concretamente, a noção de terminação baseada em tipos é formalizada utilizando uma forma restrita de dependência de tipos, também conhecida por tipos indexados. Cada tipo de dados é visto como uma família de aproximações, indexada por um conjunto de níveis, fornecendo tais níveis indicações sobre o uso de construtores na formação de termos. Esta forma de garantir terminação por tipos encontra-se formalizada no que é um cálculo lambda simplesmente tipado à la Curry, com tipos indutivos paramétricos, com expressões de ponto fixo e de análise de casos. Demonstra-se que λˆ é um cálculo bem comportado, satisfazendo as propriedades de confluência, preservação de tipos ao longo da cadeia de redução, e normalização forte. O sistema λˆ permite codificar muitas definições recursivas que são rejeitadas por outros sistemas com preocupações semelhantes de garantia de terminação. Em particular, prova-se que este cálculo engloba de modo estrito o sistema λς de Giménez, um sistema em que a terminação das expressões tipáveis é assegurada por uma condição sintáctica que restringe as chamadas recursivas de funções. Na segunda parte da tese, apresenta-se um sistema de tipos com subtipagem por construtores e estudam-se as suas propriadades. A subtipagem por construtores é uma forma de subtipagem na qual um tipo indutivo σ é visto como um subtipo de um outro tipo indutivo τ, se τ tiver mais construtores do que σ. Neste trabalho, a subtipagem por construtores está presente no sistema λcs, um cálculo lambda simplesmente tipado, à la Curry, com tipos inductivos paramétricos e mutuamente recursivos, com expressões de ponto fixo e de análise de casos. Demonstra-se que este cálculo é confluente, a tipagem é decidível e a redução preserva tipos. Para garantir a normalização forte, são propostas duas abordagens: satisfação de uma condição sintáctica nas definições recursivas (à semelhança de λς), ou enriquecimento do sistema de tipos com níveis (à semelhança de λˆ) de forma a garantir terminação por tipagem. Esta forma de subtipagem encontra aplicações nos sistemas de prova assistida e nas linguagens funcionais de programação. Em particular, a subtipagem por construtores revela-se adequada para o tratamento de tipos de dados extensíveis. A combinação da subtipagem com a sobrecarga de construtores permite que a definição de novos tipos de dados possa ser feita por restrição ou expansão do conjunto de construtores de um tipo de dados jà definido. Esta flexibilidade na definição de tipos de dados induz uma forma de re-utilização de código adequada às funções recursivas, permitindo que a definição de novas funções se possa fazer também por restrição ou expansão de funções já definidas. Estes mecanismos são estudados no âmbito do sistema λcs+fun, um cálculo lambda com subtipagem por construtores e com definições recursivas sobrecarregadas e extensíveis, definidas por concordância de padrões num ambiente global. Define-se, para este cálculo, o conceito de ambiente bem formado de funções, e demonstra-se que, para estes ambientes, as propriedades de confluência, decidibilidade de tipagem e preservação de tipos são válidas. Também se demonstra que os vários requisitos impostos para garantir a boa formação do ambiente global de funções correspondem a propriedades decidíveis. Finalmente, descreve-se um algoritmo de compilação das funções definidas por concordância de padrões para expressões com análise de casos

    Investigations in intersection types : confluence, and semantics of expansion in the -calculus, and a type error slicing method

    Get PDF
    Type systems were invented in the early 1900s to provide foundations for Mathematics where types were used to avoid paradoxes. Type systems have then been developed and extended throughout the years to serve different purposes such as efficiency or expressiveness. The λ-calculus is used in programming languages, logic, mathematics, and linguistics. Intersection types are a kind of types used for building semantic models of the λ-calculus and for static analysis of computer programs. The confluence property was used to prove the λ-calculus’ consistency and the uniqueness of normal forms. Confluence is useful to show that logics are sensibly designed, and to make equality decision procedures for use in theorem provers. Some proofs of the λ-calculus’ confluence are based on syntactic concepts (reduction relations and λ-term sets) and some on semantic concepts (type interpretations). Part I of this thesis presents an original syntactic proof that is a simplification of a semantic proof based on a sound type interpretation w.r.t. an intersection type system. Our proof can be seen as bridging some semantic and syntactic proofs. Expansion is an operation on typings (pairs of type environments and result types) in type systems for the λ-calculus. It was introduced to prove that the principal typing property (i.e., that every typable term has a strongest typing) holds in intersection type systems. Expansion variables were introduced to simplify the expansion mechanism. Part II of this thesis presents a complete realisability semantics w.r.t. an intersection type system with infinitely many expansion variables. This represents the first study on semantics of expansion. Providing sound (and complete) realisability semantics allows one to study the algorithmic behaviour of typed λ-terms through their types w.r.t. a type system. We believe such semantics will cast some light on the not yet well understood expansion operation. Intersection types were used in a type error slicer for the SML programming language. Existing compilers for many languages have confusing type error messages. Type error slicing (TES) helps the programmer by isolating the part of a program contributing to a type error (a slice). TES was initially done for a tiny toy language (the λ-calculus with polymorphic let-expressions). Extending TES to a full language is extremely challenging, and for SML we needed a number of innovations. Some issues would be faced for any language, and some are SML-specific but representative of the complexity of language-specific issues likely to be faced for other languages. Part III of this thesis solves both kinds of issues and presents an original, simple, and general constraint system for providing type error slices for ill-typed programs. We believe TES helps demystify language features known to confuse users

    Simplifying the Analysis of C++ Programs

    Get PDF
    Based on our experience of working with different C++ front ends, this thesis identifies numerous problems that complicate the analysis of C++ programs along the entire spectrum of analysis applications. We utilize library, language, and tool extensions to address these problems and offer solutions to many of them. In particular, we present efficient, expressive and non-intrusive means of dealing with abstract syntax trees of a program, which together render the visitor design pattern obsolete. We further extend C++ with open multi-methods to deal with the broader expression problem. Finally, we offer two techniques, one based on refining the type system of a language and the other on abstract interpretation, both of which allow developers to statically ensure or verify various run-time properties of their programs without having to deal with the full language semantics or even the abstract syntax tree of a program. Together, the solutions presented in this thesis make ensuring properties of interest about C++ programs available to average language users

    Programmiersprachen und Rechenkonzepte

    Get PDF
    Seit 1984 veranstaltet die GI-Fachgruppe "Programmiersprachen und Rechenkonzepte" regelmäßig im Frühjahr einen Workshop im Physikzentrum Bad Honnef. Das Treffen dient in erster Linie dem gegenseitigen Kennenlernen, dem Erfahrungsaustausch, der Diskussion und der Vertiefung gegenseitiger Kontakte. In diesem Forum werden Vorträge und Demonstrationen sowohl bereits abgeschlossener als auch noch laufender Arbeiten vorgestellt, unter anderem (aber nicht ausschließlich) zu Themen wie - Sprachen, Sprachparadigmen, - Korrektheit von Entwurf und Implementierung, -Werkzeuge, -Software-/Hardware-Architekturen, -Spezifikation, Entwurf, - Validierung, Verifikation, - Implementierung, Integration, - Sicherheit (Safety und Security), - eingebettete Systeme, - hardware-nahe Programmierung. In diesem Technischen Bericht sind einige der präsentierten Arbeiten zusammen gestellt
    corecore