A Debugger-Cooperative Higher-Order Contract System in Python

Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 10017)

Abstract

Contract programming is one of the most promising ways of enhancing the reliability of Python, which becomes increasingly desired. Higher-order contract systems that support fully specifying the behaviors of iterators and functions are desirable for Python but have not been presented yet. Besides, even with them, debugging with contracts in Python would still be burdensome because of delayed contract checking. To resolve this problem, we present PyBlame, a higher-order contract system in Python, and ccdb, a source-level debugger equipped with features dedicated to debugging with delayed contract checking. PyBlame and ccdb are designed on the basis of the standard of Python and thus friendly to many Python programmers. We have experimentally confirmed the advantage and the efficacy of PyBlame and ccdb through the web framework Bottle.

Keywords

Contracts Python Debugging 

References

  1. 1.
    D12.1: High-level backends and interpreter feature prototypes. PyPy EU-Report (2007)Google Scholar
  2. 2.
    Carrillo-Castellon, M., Garcia-Molina, J., Pimentel, E., Repiso, I.: Design by contract in smalltalk. J. Object-Oriented Program 7(9), 23–28 (1996)Google Scholar
  3. 3.
    Chiş, A., Gîrba, T., Nierstrasz, O.: The moldable debugger: a framework for developing domain-specific debuggers. In: Proceedings of the 2015 ACM SIGPLAN International Conference on Software Language Engineering, SLE 2014, pp. 102–121. ACM (2014)Google Scholar
  4. 4.
    Chitil, O.: Practical typed lazy contracts. In: Proceedings of the 17th ACM SIGPLAN International Conference on Functional Programming, ICFP 2012, pp. 67–76. ACM (2012)Google Scholar
  5. 5.
    Chugh, R., Herman, D., Jhala, R.: Dependent types for JavaScript. In: Proceedings of the 2012 ACM International Conference on Object Oriented Programming Systems Languages and Applications, OOPSLA 2012, pp. 587–606. ACM (2012)Google Scholar
  6. 6.
    Chugh, R., Rondon, P.M., Jhala, R.: Nested refinements: a logic for duck typing. In: Proceedings of the 39th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2012, pp. 231–244. ACM (2012)Google Scholar
  7. 7.
    Dimoulas, C., Findler, R.B., Felleisen, M.: Option contracts. In: Proceedings of the 2013 ACM SIGPLAN International Conference on Object Oriented Programming Systems Languages and Applications, OOPSLA 2013, pp. 475–494. ACM (2013)Google Scholar
  8. 8.
    Eby, P.J.: PEP 3333 - Python Web Server Gateway Interface v1.0.1 (2010). https://www.python.org/dev/peps/pep-3333/
  9. 9.
    Fähndrich, M., Barnett, M., Leijen, D., Logozzo, F.: Integrating a set of contract checking tools into visual studio. In: Proceedings of the Second International Workshop on Developing Tools as Plug-Ins, TOPI 2012, pp. 43–48. IEEE (2012)Google Scholar
  10. 10.
    Findler, R.B., Felleisen, M.: Contracts for higher-order functions. In: Proceedings of the Seventh ACM SIGPLAN International Conference on Functional Programming, ICFP 2002, pp. 48–59. ACM (2002)Google Scholar
  11. 11.
    Flanagan, C.: Hybrid type checking. In: Conference Record of the 33rd ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2006, pp. 245–256. ACM (2006)Google Scholar
  12. 12.
    Heidegger, P., Bieniusa, A., Thiemann, P.: Access permission contracts for scripting languages. In: Proceedings of the 39th Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, POPL 2012, pp. 111–122. ACM (2012)Google Scholar
  13. 13.
    Heidegger, P., Thiemann, P.: Contract-driven testing of JavaScript code. In: Vitek, J. (ed.) TOOLS 2010. LNCS, vol. 6141, pp. 154–172. Springer, Heidelberg (2010). doi:10.1007/978-3-642-13953-6_9 CrossRefGoogle Scholar
  14. 14.
    Keil, M., Thiemann, P.: Blame assignment for higher-order contracts with intersection and union. In: Proceedings of the 20th ACM SIGPLAN International Conference on Functional Programming, ICFP 2015, pp. 375–386. ACM (2015)Google Scholar
  15. 15.
    Klein, C., Flatt, M., Findler, R.B.: Random testing for higher-order, stateful programs. In: Proceedings of the 2010 ACM International Conference on Object Oriented Programming Systems Languages and Applications, OOPSLA 2010, pp. 555–566. ACM (2010)Google Scholar
  16. 16.
    Knowles, K., Flanagan, C.: Hybrid type checking. ACM Trans. Program. Lang. Syst. 32(2), 6:1–6:34 (2010)CrossRefGoogle Scholar
  17. 17.
    Meyer, B.: Applying “Design by Contract”. Computer 25(10), 40–51 (1992)CrossRefGoogle Scholar
  18. 18.
    Plösch, R.: Design by contract for Python. In: Proceedings of the Fourth Asia-Pacific Software Engineering and International Computer Science Conference, APSEC 1997, pp. 213–219. IEEE (1997)Google Scholar
  19. 19.
    van Rossum, G., Lehtosalo, J., Langa, Ł.: PEP 484 - Type Hints (2014). https://www.python.org/dev/peps/pep-0484/
  20. 20.
    Siek, J.G., Taha, W.: Gradual typing for functional languages. In: Scheme and Functional Programming 2006. TR-2006-06, University of Chicago (2006)Google Scholar
  21. 21.
    Strickland, T.S., Dimoulas, C., Takikawa, A., Felleisen, M.: Contracts for first-class classes. ACM Trans. Program. Lang. Syst. 35(3), 11:1–11:58 (2013)CrossRefGoogle Scholar
  22. 22.
    Strickland, T.S., Felleisen, M.: Contracts for first-class classes. In: Proceedings of the 6th Symposium on Dynamic Languages, DLS 2010, pp. 97–112. ACM (2010)Google Scholar
  23. 23.
    Strickland, T.S., Tobin-Hochstadt, S., Findler, R.B., Flatt, M.: Chaperones and impersonators: run-time support for reasonable interposition. In: Proceedings of the 2012 ACM International Conference on Object Oriented Programming Systems Languages and Applications, OOPSLA 2012, pp. 943–962. ACM (2012)Google Scholar
  24. 24.
    Vitousek, M.M., Kent, A.M., Siek, J.G., Baker, J.: Design and evaluation of gradual typing for Python. In: Proceedings of the 10th ACM Symposium on Dynamic Languages, DLS 2014, pp. 45–56. ACM (2014)Google Scholar
  25. 25.
    Wei, Y., Pei, Y., Furia, C.A., Silva, L.S., Buchholz, S., Meyer, B., Zeller, A.: Automated fixing of programs with contracts. In: Proceedings of the 19th International Symposium on Software Testing and Analysis, ISSTA 2010, pp. 61–72. ACM (2010)Google Scholar
  26. 26.
    Zhang, C., Yan, D., Zhao, J., Chen, Y., Yang, S.: BPGen: an automated breakpoint generator for debugging. In: Proceedings of the 32nd ACM/IEEE International Conference on Software Engineering, ICSE 2010, vol. 2, pp. 271–274. ACM (2010)Google Scholar

Copyright information

© Springer International Publishing AG 2016

Authors and Affiliations

  1. 1.The University of Electro-CommunicationsTokyoJapan
  2. 2.Kochi University of TechnologyKochiJapan

Personalised recommendations