Skip to main navigation Skip to search Skip to main content

What Types Are Needed for Typing Dynamic Objects? A Python-Based Empirical Study

Research output: Chapter in Book/Report/Conference proceedingConference Contribution (Conference Proceeding)

1 Citation (Scopus)

Abstract

Dynamic object-oriented languages, such as Python, Ruby, and Javascript are widely used nowadays. A distinguishing feature of dynamic object-oriented languages is that objects, the fundamental runtime data representation, are highly dynamic, meaning that a single constructor may create objects with different types and objects can evolve freely after their construction. While such dynamism facilitates fast prototyping, it brings many challenges to program understanding. Many type systems have been developed to aid programming understanding, and they adopt various types and techniques to represent and track dynamic objects. However, although many types and techniques have been proposed, it is unclear which one suits real dynamic object usages best. Motivated by this situation, we perform an empirical study on 50 mature Python programs with a focus on object dynamism and object type models. We found that (1) object dynamism is highly prevalent in Python programs, (2) class-based types are not precise to handle dynamic behaviors, as they introduce type errors for 52% of the evaluated polymorphic attributes, (3) typestate-based types, although mostly used in static languages, matches the behaviors of dynamic objects faithfully, and (4) some well-designed but still lightweight techniques for object-based types, such as argument type separation and recency abstraction can precisely characterize dynamic object behaviors. Those techniques are suitable for building precise but still concise object-based types.

Original languageEnglish
Title of host publicationProgramming Languages and Systems
Subtitle of host publication21st Asian Symposium, APLAS 2023
PublisherSpringer
Pages24-45
DOIs
Publication statusPublished - 21 Nov 2023
EventAPLAS 2023: 21st Asian Symposium - Taipei, Taiwan
Duration: 26 Nov 202329 Nov 2023
https://conf.researchr.org/home/aplas-2023/

Publication series

NameLecture Notes in Computer Science (LNCS)
PublisherSpringer
ISSN (Print)0302-9743
ISSN (Electronic)1611-3349

Conference

ConferenceAPLAS 2023
Country/TerritoryTaiwan
Period26/11/2329/11/23
Internet address

Research Groups and Themes

  • Programming Languages

Fingerprint

Dive into the research topics of 'What Types Are Needed for Typing Dynamic Objects? A Python-Based Empirical Study'. Together they form a unique fingerprint.

Cite this