Types for Flexible Objects

  • Zachary Palmer
  • Pottayil Harisanker Menon
  • Alexander Rozenshteyn
  • Scott Smith
Part of the Lecture Notes in Computer Science book series (LNCS, volume 8858)


Scripting languages are popular in part due to their extremely flexible objects. Features such as dynamic extension, mixins, and first-class messages improve programmability and lead to concise code. But attempts to statically type these features have met with limited success. Here we present TinyBang, a small typed language in which flexible object operations can be encoded. We illustrate this flexibility by solving an open problem in OO literature: we give an encoding where objects can be extended after being messaged without compromising the expressiveness of subtyping. TinyBang’s subtype constraint system ensures that all types are completely inferred; there are no data declarations or type annotations. We formalize TinyBang and prove the type system is sound and decidable; all examples in the paper run in our most recent implementation.


Type System Operational Semantic Type Inference Type Annotation Constraint Closure 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. [AWL94]
    Aiken, A., Wimmers, E.L., Lakshman, T.K.: Soft typing with conditional types. In: POPL 21, pp. 163–173 (1994)Google Scholar
  2. [BAC06]
    Blume, M., Acar, U.A., Chae, W.: Extensible programming with first-class cases. In: ICFP, pp. 239–250 (2006)Google Scholar
  3. [BBV11]
    Bettini, L., Bono, V., Venneri, B.: Delegation by object composition. Science of Computer Programming 76, 992–1014 (2011)CrossRefzbMATHGoogle Scholar
  4. [BCP99]
    Bruce, K.B., Cardelli, L., Pierce, B.C.: Comparing object encodings. Information and Computation 155(1-2), 108–133 (1999)MathSciNetCrossRefzbMATHGoogle Scholar
  5. [BF98]
    Bono, V., Fisher, K.: An imperative, first-order calculus with object extension. In: Jul, E. (ed.) ECOOP 1998. LNCS, vol. 1445, pp. 462–497. Springer, Heidelberg (1998)CrossRefGoogle Scholar
  6. [CNX+14]
    Castagna, G., Nguyen, K., Xu, Z., Im, H., Lenglet, S., Padovani, L.: Polymorphic functions with set-theoretic types. Part 1: Syntax, semantics, and evaluation. In: POPL (2014)Google Scholar
  7. [CRJ12]
    Chugh, R., Rondon, P.M., Jhala, R.: Nested refinements: A logic for duck typing. In: POPL (2012)Google Scholar
  8. [FAFH09]
    Furr, M., (David) An, J.-H., Foster, J.S., Hicks, M.: Static type inference for Ruby. In: SAC (2009)Google Scholar
  9. [MC99]
    Millstein, T.D., Chambers, C.: Modular statically typed multimethods. In: Guerraoui, R. (ed.) ECOOP 1999. LNCS, vol. 1628, pp. 279–303. Springer, Heidelberg (1999)CrossRefGoogle Scholar
  10. [MPRS14a]
    Menon, P.H., Palmer, Z., Rozenshteyn, A., Smith, S.: Tinybang implementation (March 2014),
  11. [MPRS14b]
    Menon, P.H., Palmer, Z., Rozenshteyn, A., Smith, S.: Types for flexible objects. Technical report, The Johns Hopkins University Programming Languages Laboratory (March 2014),
  12. [Nis98]
    Nishimura, S.: Static typing for dynamic messages. In: POPL (1998)Google Scholar
  13. [Pot00]
    Pottier, F.: A versatile constraint-based type inference system. Nordic J. of Computing 7(4), 312–347 (2000)MathSciNetzbMATHGoogle Scholar
  14. [Rémy94]
    Rémy, D.: Type inference for records in a natural extension of ML. In: Theoretical Aspects of Object-Oriented Programming. MIT Press (1994)Google Scholar
  15. [RS02]
    Riecke, J.G., Stone, C.A.: Privacy via subsumption. Inf. Comput. 172(1), 2–28 (2002)MathSciNetCrossRefzbMATHGoogle Scholar
  16. [SM01]
    Shields, M., Meijer, E.: Type-indexed rows. In: POPL, pp. 261–275 (2001)Google Scholar
  17. [WS01]
    Wang, T., Smith, S.F.: Precise constraint-based type inference for Java. In: Lindskov Knudsen, J. (ed.) ECOOP 2001. LNCS, vol. 2072, pp. 99–177. Springer, Heidelberg (2001)CrossRefGoogle Scholar

Copyright information

© Springer International Publishing Switzerland 2014

Authors and Affiliations

  • Zachary Palmer
    • 1
  • Pottayil Harisanker Menon
    • 1
  • Alexander Rozenshteyn
    • 1
  • Scott Smith
    • 1
  1. 1.Department of Computer ScienceThe Johns Hopkins UniversityUSA

Personalised recommendations