Adding Dynamic Types to C#
Adding Dynamic Types to C#
复制标题
向 C 添加动态类型
DOI:
10.1007/978-3-642-14107-2_5
复制
发表时间:
2010
期刊:
影响因子:
--
通讯作者:
Mads Torgersen
中科院分区:
文献类型:
--
作者:
G. Bierman;E. Meijer;Mads Torgersen
Developers using statically typed languages such as C≠ and Java are increasingly having to interoperate with APIs and object models defined in dynamic languages. This impedance mismatch results in code that is difficult to understand, awkward to analyze, and expensive to maintain. In this paper we describe new features in C≠4.0 that support the safe combination of dynamically and statically typed code by deferring type checking of program fragments with static type dynamic until runtime.When executed, these dynamic code fragments are type-checked and resolved using the same rules as statically typed code. We formalize these features in a core fragment of C≠ and prove important safety properties. In particular, we show that subtyping remains transitive.