skip to main content
10.1145/2384577.2384582acmconferencesArticle/Chapter ViewAbstractPublication PagessplashConference Proceedingsconference-collections
research-article

Robust scripting via patterns

Published:22 October 2012Publication History

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.

References

  1. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  2. R. M. Burstall, D. B. MacQueen, and D. T. Sannella. Hope: An experimental applicative language, 1980.Google ScholarGoogle Scholar
  3. Burak Emir, Martin Odersky, and John Williams. Matching objects with patterns. In European Conference on Object-Oriented Programming (ECOOP), pages 273--298, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  5. David Flanagan and Yukihiro Matsumoto. The Ruby Programming Language. O'Reilly, 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. 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 ScholarGoogle Scholar
  7. Ralph E. Griswold, J. F. Poage, and Ivan P. Polonsky. The SNOBOL 4 Programming Language. Prentice-Hall, Englewood Cliffs, NJ, 1968. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  9. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  10. Roberto Ierusalimschy. Programming in Lua. Lua.org, second edition, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Barry Jay and Delia Kesner. First-class patterns. Journal of Functional Programming (JFP), 19(02):191--225, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. JetBrains. Kotlin language project page. http://confluence.jetbrains.net/display/Kotlin/.Google ScholarGoogle Scholar
  13. P. J. Landin. The next 700 programming languages. Communications of the ACM (CACM), 9(3):157--166, March 1966. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  15. Robin Milner, Mads Tofte, Robert Harper, and David Macqueen. The Definition of Standard ML - Revised. The MIT Press, rev sub edition, May 1997. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  17. Chris Okasaki. Purely Functional Data Structures. Cambridge University Press, June 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Python programming language -- official website. http://python.org/.Google ScholarGoogle Scholar
  19. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  20. Laurence Tratt. Domain specific language implementation via compile-time meta-programming. Transactions on Programming Languages and Systems (TOPLAS), 30(6), 2008. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  22. Larry Wall, Tom Christiansen, and Jon Orwant. Programming Perl. O'Reilly, third edition, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. Alessandro Warth and Ian Piumarta. OMeta: An object-oriented language for pattern matching. In Dynamic Languages Symposium (DLS), pages 11--19, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. Andrew K. Wright. Pattern matching for Scheme, 1996. The match special form is part of PLT Scheme's MzLib library.Google ScholarGoogle Scholar

Index Terms

  1. Robust scripting via patterns

      Recommendations

      Comments

      Login options

      Check if you have access through your login credentials or your institution to get full access on this article.

      Sign in
      • Published in

        cover image ACM Conferences
        DLS '12: Proceedings of the 8th symposium on Dynamic languages
        October 2012
        128 pages
        ISBN:9781450315647
        DOI:10.1145/2384577
        • cover image ACM SIGPLAN Notices
          ACM SIGPLAN Notices  Volume 48, Issue 2
          DLS '12
          February 2013
          114 pages
          ISSN:0362-1340
          EISSN:1558-1160
          DOI:10.1145/2480360
          Issue’s Table of Contents

        Copyright © 2012 ACM

        Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

        Publisher

        Association for Computing Machinery

        New York, NY, United States

        Publication History

        • Published: 22 October 2012

        Permissions

        Request permissions about this article.

        Request Permissions

        Check for updates

        Qualifiers

        • research-article

        Acceptance Rates

        Overall Acceptance Rate32of77submissions,42%

        Upcoming Conference

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader