Gradual Typing in an Open World
نویسندگان
چکیده
Gradual typing combines static and dynamic typing in the same language, offering the benefits of both to programmers. Static typing provides error detection and strong guarantees while dynamic typing enables rapid prototyping and flexible programming idioms. For programmers to take full advantage of a gradual type system, however, they must be able to trust their type annotations, and so runtime checks must be performed at boundaries between static and dynamic code to ensure that static types are respected. Higher order and mutable values cannot be completely checked at these boundaries, and so additional checks must be performed at their use sites. Traditionally, this has been achieved by installing proxies on these values to moderate the flow of data between static and dynamic code, but this can cause problems if the language supports comparison of object identity or foreign function interfaces. Reticulated Python is a gradually typed variant of Python 3 implemented via a source-tosource translator. It implements a proxy-free design named transient casts. This paper presents a formal semantics for transient casts and shows that not only are they sound, but they work in an open-world setting in which the Reticulated translator has only been applied to some of the program; the rest is untranslated Python. We formalize this open world soundness property and use Coq to prove that it holds for Anthill Python, a calculus that models Reticulated Python.
منابع مشابه
Refined Criteria for Gradual Typing
Siek and Taha [2006] coined the term gradual typing to describe a theory for integrating static and dynamic typing within a single language that 1) puts the programmer in control of which regions of code are statically or dynamically typed and 2) enables the gradual evolution of code between the two typing disciplines. Since 2006, the term gradual typing has become quite popular but its meaning...
متن کاملGradual Typing for Functional Languages
Static and dynamic type systems have well-known strengths and weaknesses, and each is better suited for different programming tasks. There have been many efforts to integrate static and dynamic typing and thereby combine the benefits of both typing disciplines in the same language. The flexibility of static typing can be improved by adding a type Dynamic and a typecase form. The safety and perf...
متن کاملViewpoint : India ’ S Nuclear Labyrinth
William Walker is professor of international relations at the University of St. Andrews in Scotland. He is the co-author with David Albright and Frans Berkhout of SIPRI’s Plutonium and Highly Enriched Uranium: World Inventories, Capabilities and Policies (forthcoming, 1996). There have been many recent cases of states reversing course. Russia has embraced capitalism and democracy, China has thr...
متن کاملFrom Optional to Gradual Typing via Transient Checks
Gradual typing [11, 16] has seen widespread use over the last several years, in both academic research [1, 2, 9, 10, 12–14] and industrial language design [5, 6, 8]. Many recent implementations of gradual typing are translations to an existing untyped target language. Some of these translation do not perform runtime checking, which is needed for gradual soundness, in part because of the complex...
متن کاملType Refinements in an Open World (Extended Abstract)
A refinement is a predicate on the elements of a type that describes their execution behavior. Much work has gone into developing refinements in a closed world, in which the classes of values of a type are fixed statically, as in the case of the natural numbers with zero and succ. Relatively little work has gone into developing refinements in an open world in which new classes may be added dyna...
متن کاملذخیره در منابع من
با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید
برای دانلود متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید
ثبت ناماگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید
ورودعنوان ژورنال:
- CoRR
دوره abs/1610.08476 شماره
صفحات -
تاریخ انتشار 2016