Title
Patterns as objects in grace
Abstract
Object orientation and pattern matching are often seen as conflicting approaches to program design. Object-oriented programs place type-dependent behavior inside objects and invoke it via dynamic dispatch, while pattern-matching programs place type-dependent behavior 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. We explain how this conflict can be resolved gracefully: by modelling patterns and cases as partial functions, reifying those functions as objects, and then building up complex patterns from simpler ones using pattern combinators. We describe the implementation of this design as an object-oriented framework, and a case study of its effectiveness.
Year
DOI
Venue
2012
10.1145/2384577.2384581
DLS
Keywords
Field
DocType
pattern combinators,type-dependent behavior,object-oriented language,dynamic dispatch,case statement,object-oriented framework,complex pattern,case study,pattern matching,modelling pattern,grace,object orientation
State pattern,Object-oriented design,Data structure,Programming language,Method,Computer science,Combinatory logic,Software design pattern,Dynamic dispatch,Theoretical computer science,Pattern matching
Conference
Volume
Issue
ISSN
48
2
0362-1340
Citations 
PageRank 
References 
7
0.70
8
Authors
5
Name
Order
Citations
PageRank
Michael Homer14610.38
James Noble21683163.52
Kim B. Bruce31169168.81
Andrew P. Black41566366.84
David J. Pearce537829.53