Dynamic typing as staged type inference

作者: Mark Shields , Tim Sheard , Simon Peyton Jones

DOI: 10.1145/268946.268970

关键词: Type inferenceComputer scienceProgramming languageData typeManifest typingType systemStrong and weak typingOperational semanticsDuck typingParametric polymorphismTheoretical computer science

摘要: Dynamic typing extends statically typed languages with a universal datatype, simplifying programs which must manipulate other as data, such distributed, persistent, interpretive and generic programs. Current approaches, however, limit the use of polymorphism in dynamic values, can be syntactically awkward.We introduce new approach to typing, based on staged computation, allows single type-reconstruction algorithm execute partly at compile time run-time. This seamlessly type system accommodate types that are only known run-time, while still supporting both inference polymorphism. The is significantly more expressive than approaches. Furthermore it implemented efficiently; most done compile-time, leaving some residual unification for run-time.We demonstrate our by examples small polymorphic functional language, present its system, reconstruction algorithm, operational semantics. Our proposal could also readily adapted many programming languages.

参考文章(28)
Peter Sestoft, Neil D. Jones, Carsten K. Gomard, Partial evaluation and automatic program generation ,(1993)
Flemming Nielson, Hanne Riis Nielson, Two Level Functional Languages ,(1992)
Alexander Aiken, Edward L. Wimmers, T. K. Lakshman, Soft typing with conditional types symposium on principles of programming languages. pp. 163- 173 ,(1994) , 10.1145/174675.177847
A.K. Wright, M. Felleisen, A Syntactic Approach to Type Soundness Information & Computation. ,vol. 115, pp. 38- 94 ,(1994) , 10.1006/INCO.1994.1093
Eugenio Moggi, A categorical account of two-level languages Electronic Notes in Theoretical Computer Science. ,vol. 6, pp. 272- ,(1997) , 10.1016/S1571-0661(05)80155-0
Martin Odersky, Konstantin Läufer, Putting type annotations to work symposium on principles of programming languages. pp. 54- 67 ,(1996) , 10.1145/237721.237729
Martín Abadi, Luca Cardelli, Benjamin Pierce, Gordon Plotkin, Dynamic typing in a statically typed language ACM Transactions on Programming Languages and Systems. ,vol. 13, pp. 237- 268 ,(1991) , 10.1145/103135.103138
Rowan Davies, Frank Pfenning, A modal analysis of staged computation symposium on principles of programming languages. pp. 258- 270 ,(1996) , 10.1145/237721.237788
Fritz Henglein, Jakob Rehof, Safe polymorphic type inference for a dynamically typed language: translating Scheme to ML international conference on functional programming. pp. 192- 203 ,(1995) , 10.1145/224164.224203