Open Access. Powered by Scholars. Published by Universities.®

Portland State University

Series

Programming languages (Electronic computers)--Software

Publication Year

Articles 1 - 2 of 2

Full-Text Articles in Programming Languages and Compilers

Modules And Dialects As Objects In Grace, Michael Homer, James Noble, Kim B. Bruce, Andrew P. Black Jan 2013

Modules And Dialects As Objects In Grace, Michael Homer, James Noble, Kim B. Bruce, Andrew P. Black

Computer Science Faculty Publications and Presentations

Grace is a gradually typed, object-oriented language for use in education; consonant with that use, we have tried to keep Grace as simple and straightforward as possible. Grace needs a module system for several reasons: to teach students about modular program design, to organise large programs, especially its self-hosted implementation, to provide access to resources defined in other languages, and to support different “dialects”—language subsets, or domain specific languages, for particular parts of the curriculum. Grace already has several organising constructs; this paper describes how Grace uses two of them, objects and lexical scope, to provide modules and dialects.


Patterns As Objects In Grace, Andrew P. Black, Michael Homer, James Noble, David J. Pearce, Kim B. Bruce Jan 2012

Patterns As Objects In Grace, Andrew P. Black, Michael Homer, James Noble, David J. Pearce, Kim B. Bruce

Computer Science Faculty Publications and Presentations

Object orientation and pattern matching are often seen as conflicting approaches to program design. Object oriented programs place type-dependent behaviour inside objects and invoke it via dynamic dispatch, while pattern matching programs place type-dependent behaviour outside data structures and invoke it via multiway conditionals (case statements). Grace is a new, dynamic, object-oriented language designed to support teaching: to this end, Grace needs to support both styles. In this paper we explain how this conflict can be resolved gracefully: by modelling patterns and cases as partial functions, reifying those functions as first-class objects, and then building up complex patterns from simpler …