ABSTRACT
Dynamic typing in scripting languages is a two-edged sword. On the one hand, it can be more flexible and more concise than static typing. On the other hand, it can lead to less robust code. We argue that patterns can give scripts much of the robustness of static typing, without losing the flexibility and concision of dynamic typing. To make this case, we describe a rich pattern system in the dynamic language Thorn. Thorn patterns interact with its control constructs and scoping rules to support concise and robust test-and-extract idioms. Thorn patterns encompass an extensive set of features from ML-style patterns to regular expressions and beyond. And Thorn patterns can be first-class and support pattern-punning (mirror constructor syntax). Overall, this paper describes a powerful pattern system that makes scripting more robust.
- Bard Bloom, John Field, Nathaniel Nystrom, Johan Östlund, Gregor Richards, Rok Strnisa, Jan Vitek, and Tobias Wrigstad. Thorn: robust, concurrent, extensible scripting on the JVM. In Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA), pages 117--136, October 2009. Google ScholarDigital Library
- R. M. Burstall, D. B. MacQueen, and D. T. Sannella. Hope: An experimental applicative language, 1980.Google Scholar
- Burak Emir, Martin Odersky, and John Williams. Matching objects with patterns. In European Conference on Object-Oriented Programming (ECOOP), pages 273--298, 2007. Google ScholarDigital Library
- Michael D. Ernst, Craig S. Kaplan, and Craig Chambers. Predicate dispatching: A unified theory of dispatch. In European Conference for Object-Oriented Programming (ECOOP), pages 186--211, 1998. Google ScholarDigital Library
- David Flanagan and Yukihiro Matsumoto. The Ruby Programming Language. O'Reilly, 2008. Google ScholarDigital Library
- Felix Geller, Robert Hirschfeld, and Gilad Bracha. Pattern matching for an object-oriented dynamically typed programming language. Technical Report Hasso Plattner Institute Technical Report 36, University of Potsdam, 2010.Google Scholar
- Ralph E. Griswold, J. F. Poage, and Ivan P. Polonsky. The SNOBOL 4 Programming Language. Prentice-Hall, Englewood Cliffs, NJ, 1968. Google ScholarDigital Library
- Martin Hirzel, Nathaniel Nystrom, Bard Bloom, and Jan Vitek. Matchete: Paths through the pattern matching jungle. In Practical Aspects of Declarative Languages (PADL), pages 150--166, 2008. Google ScholarDigital Library
- Paul Hudak, Simon L. Peyton Jones, Philip Wadler, Brian Boutel, Jon Fairbairn, Joseph H. Fasel, Marıa M. Guzmán, Kevin Hammond, John Hughes, Thomas Johnsson, Richard B. Kieburtz, Rishiyur S. Nikhil, Will Partain, and John Peterson. Report on the programming language Haskell, a non-strict, purely functional language. SIGPLAN Notices, 27(5):R1--R164, 1992. Google ScholarDigital Library
- Roberto Ierusalimschy. Programming in Lua. Lua.org, second edition, 2006. Google ScholarDigital Library
- Barry Jay and Delia Kesner. First-class patterns. Journal of Functional Programming (JFP), 19(02):191--225, 2009. Google ScholarDigital Library
- JetBrains. Kotlin language project page. http://confluence.jetbrains.net/display/Kotlin/.Google Scholar
- P. J. Landin. The next 700 programming languages. Communications of the ACM (CACM), 9(3):157--166, March 1966. Google ScholarDigital Library
- Jed Liu and Andrew C. Myers. JMatch: Iterable abstract pattern matching for Java. In Practical Aspects of Declarative Languages (PADL), pages 273--298, 2003. Google ScholarDigital Library
- Robin Milner, Mads Tofte, Robert Harper, and David Macqueen. The Definition of Standard ML - Revised. The MIT Press, rev sub edition, May 1997. Google ScholarDigital Library
- Pierre-Etienne Moreau, Christophe Ringeissen, and Marian Vittek. A pattern matching compiler for multiple target languages. In International Conference on Compiler Construction (CC), 2003. Google ScholarDigital Library
- Chris Okasaki. Purely Functional Data Structures. Cambridge University Press, June 1999. Google ScholarDigital Library
- Python programming language -- official website. http://python.org/.Google Scholar
- Don Syme, Gergory Neverov, and James Margetson. Extensible pattern matching via a lightweight language extension. In International Conference on Functional Programming (ICFP), pages 29--40, 2007. Google ScholarDigital Library
- Laurence Tratt. Domain specific language implementation via compile-time meta-programming. Transactions on Programming Languages and Systems (TOPLAS), 30(6), 2008. Google ScholarDigital Library
- P. Wadler. Views: a way for pattern matching to cohabit with data abstraction. In Proceedings of the 14th ACM SIGACT-SIGPLAN symposium on Principles of programming languages, POPL '87, pages 307--313, New York, NY, USA, 1987. ACM. Google ScholarDigital Library
- Larry Wall, Tom Christiansen, and Jon Orwant. Programming Perl. O'Reilly, third edition, 2000. Google ScholarDigital Library
- Alessandro Warth and Ian Piumarta. OMeta: An object-oriented language for pattern matching. In Dynamic Languages Symposium (DLS), pages 11--19, 2007. Google ScholarDigital Library
- Andrew K. Wright. Pattern matching for Scheme, 1996. The match special form is part of PLT Scheme's MzLib library.Google Scholar
Index Terms
- Robust scripting via patterns
Recommendations
Robust scripting via patterns
DLS '12Dynamic typing in scripting languages is a two-edged sword. On the one hand, it can be more flexible and more concise than static typing. On the other hand, it can lead to less robust code. We argue that patterns can give scripts much of the robustness ...
Treating Pattern Sublanguages as Patterns with an Application to Organizational Patterns
EuroPLoP '17: Proceedings of the 22nd European Conference on Pattern Languages of ProgramsOrganizing people is very important and one of the great challenges, and in particular in software development. Organizational patterns are the key to piecemeal growth of organizations. To deal with the complexity of choosing right pattern sequences and ...
Understanding the Power of Abstraction in Patterns
This unusual experience report about mining and documenting patterns describes lessons learned from writing a set of patterns. Many times, pattern stories report on an author's expertise and creation of a set of patterns and their application in that ...
Comments