Skip to main content

A Dictionary-Passing Translation of Featherweight Go

  • Conference paper
  • First Online:
Programming Languages and Systems (APLAS 2021)

Part of the book series: Lecture Notes in Computer Science ((LNPSE,volume 13008))

Included in the following conference series:

Abstract

The Go programming language is an increasingly popular language but some of its features lack a formal investigation. This article explains Go’s resolution mechanism for overloaded methods and its support for structural subtyping by means of translation from Featherweight Go to a simple target language. The translation employs a form of dictionary passing known from type classes in Haskell and preserves the dynamic behavior of Featherweight Go programs.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Subscribe and save

Springer+ Basic
$34.99 /Month
  • Get 10 units per month
  • Download Article/Chapter or eBook
  • 1 Unit = 1 Article or 1 Chapter
  • Cancel anytime
Subscribe now

Buy Now

Chapter
USD 29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever

Tax calculation will be finalised at checkout

Purchases are for personal use only

Institutional subscriptions

Similar content being viewed by others

Notes

  1. 1.

    Technically, we are passing around interface-values wrapping dictionaries of methods.

  2. 2.

    https://arxiv.org/abs/2106.14586.

References

  1. Ahmed, A.: Step-indexed syntactic logical relations for recursive and quantified types. In: Sestoft, P. (ed.) ESOP 2006. LNCS, vol. 3924, pp. 69–83. Springer, Heidelberg (2006). https://doi.org/10.1007/11693024_6

    Chapter  Google Scholar 

  2. Alpern, B., Cocchi, A., Fink, S.J., Grove, D., Lieber, D.: Efficient implementation of java interfaces: invokeinterface considered harmless. In: Proceedings of OOPSLA 2001, ACM (2001)

    Google Scholar 

  3. Bottu, G.J., Xie, N., Marntirosian, K., Schrijvers, T.: Coherence of type class resolution. Proc. ACM Program. Lang. 3(ICFP), 1–28 (2019)

    Google Scholar 

  4. Chambers, C.: Object-oriented multi-methods in Cecil. In: Madsen, O.L. (ed.) ECOOP 1992. LNCS, vol. 615, pp. 33–56. Springer, Heidelberg (1992). https://doi.org/10.1007/BFb0053029

    Chapter  Google Scholar 

  5. Driesen, K., Hölzle, U.: The direct cost of virtual function calls in C++. In: Proceedings of OOPSLA 1996, ACM (1996)

    Google Scholar 

  6. Gosling, J., et al.: The Java Language Specification, Java SE 16 edn (2021). https://docs.oracle.com/javase/specs/jls/se16/html/index.html

  7. Griesemer, R., et al.: Featherweight go. Proc. ACM Program. Lang. 4(OOPSLA), 1–29 (2020)

    Google Scholar 

  8. Hall, C.V., Hammond, K., Peyton Jones, S.L., Wadler, P.L.: Type classes in Haskell. ACM Trans. Program. Lang. Syst. 18(2), 109–132 (1996)

    Article  Google Scholar 

  9. Peyton Jones, S., Weirich, S., Eisenberg, R.A., Vytiniotis, D.: A reflection on types. In: Lindley, S., McBride, C., Trinder, P., Sannella, D. (eds.) A List of Successes That Can Change the World. LNCS, vol. 9600, pp. 292–317. Springer, Cham (2016). https://doi.org/10.1007/978-3-319-30936-1_16

    Chapter  MATH  Google Scholar 

  10. Läufer, K.: Type classes with existential types. J. Funct. Prog. 6(3), 485–518 (1996)

    Article  MathSciNet  Google Scholar 

  11. Malayeri, D., Aldrich, J.: Integrating nominal and structural subtyping. In: Vitek, J. (ed.) ECOOP 2008. LNCS, vol. 5142, pp. 260–284. Springer, Heidelberg (2008). https://doi.org/10.1007/978-3-540-70592-5_12

    Chapter  Google Scholar 

  12. Marlow, S.: Haskell 2010 language report (2010). https://www.haskell.org/onlinereport/haskell2010/

  13. Mitchell, J.C., Plotkin, G.D.: Abstract types have existential type. ACM Trans. Program. Lang. Syst. 10(3), 470–502 (1988)

    Article  Google Scholar 

  14. Morris, J.G.: A simple semantics for Haskell overloading. In: Proceedings of Haskell 2014, New York, ACM (2014)

    Google Scholar 

  15. Pierce, B.: Types and Programming Languages, 1st edn. MIT Press, Cambridge (2002)

    Google Scholar 

  16. Plotkin, G.: Lambda-definability and logical relations. Unpublished manuscript (1973)

    Google Scholar 

  17. Reppy, J.H.: Concurrent ML: design, application and semantics. In: Functional Programming, Concurrency, Simulation and Automated Reasoning, pp. 165–198. Springer, Heidelberg (1993)

    Google Scholar 

  18. Steele, G.L.: Common LISP: The Language, 2nd edn. Digital Press, Amsterdam (1990)

    MATH  Google Scholar 

  19. Sulzmann, M., Chakravarty, M.M.T., Jones, S.P., Donnelly, K.: System F with type equality coercions. In: Proceedings of TLDI 2007, New York, ACM (2007)

    Google Scholar 

  20. Tait, W.W.: Intensional interpretations of functionals of finite type I. J. Symb. Log. 32(2), 198–212 (1967)

    Article  MathSciNet  Google Scholar 

  21. Thatte, S.R.: Semantics of type classes revisited. In: Proceedings of LISP 1994, pp. 208–219. ACM (1994)

    Google Scholar 

  22. The Go programming language (2021). https://golang.org

  23. Thiemann, P., Wehr, S.: Interface types for Haskell. In: Ramalingam, G. (ed.) APLAS 2008. LNCS, vol. 5356, pp. 256–272. Springer, Heidelberg (2008). https://doi.org/10.1007/978-3-540-89330-1_19

    Chapter  Google Scholar 

  24. Wadler, P., Blott, S.: How to make ad-hoc polymorphism less ad hoc. In: Proceedings of POPL 1989, New York, ACM (1989)

    Google Scholar 

Download references

Acknowledgments

We thank the APLAS’21 reviewers for their helpful and constructive feedback.

Author information

Authors and Affiliations

Authors

Corresponding author

Correspondence to Martin Sulzmann .

Editor information

Editors and Affiliations

Rights and permissions

Reprints and permissions

Copyright information

© 2021 Springer Nature Switzerland AG

About this paper

Check for updates. Verify currency and authenticity via CrossMark

Cite this paper

Sulzmann, M., Wehr, S. (2021). A Dictionary-Passing Translation of Featherweight Go. In: Oh, H. (eds) Programming Languages and Systems. APLAS 2021. Lecture Notes in Computer Science(), vol 13008. Springer, Cham. https://doi.org/10.1007/978-3-030-89051-3_7

Download citation

  • DOI: https://doi.org/10.1007/978-3-030-89051-3_7

  • Published:

  • Publisher Name: Springer, Cham

  • Print ISBN: 978-3-030-89050-6

  • Online ISBN: 978-3-030-89051-3

  • eBook Packages: Computer ScienceComputer Science (R0)

Publish with us

Policies and ethics