Type-Safe, Generative, Binding Macros

Subscribers:
344,000
Published on ● Video Link: https://www.youtube.com/watch?v=hvwgWqcaGrI



Duration: 1:04:08
59 views
0


Macros are powerful tools that can facilitate resuse. But, with few exceptions, macros have traditionally been viewed as operations on syntax trees or even on plain strings. This view makes macros seem ad hoc, and is at odds with two desirable features of contemporary programming languages: static typing and static scoping. At a deeper level, there is a need for a simple, usable semantics for macros. We argue that these problems can be addressed by formally viewing macros as multi-stage computation. This view eliminates the need for freshness conditions and tests on variable names, and provides a compositional interpretation that can serve as a basis for designing a sound type system for languages supporting macros, or even for compilation. To illustrate our approach, we develop and present a core language that supports inlining, recursive macros, and the definition of new binding constructs. The latter is subtle, and is the most novel addition in a statically typed setting. The semantics of the core language is given by an interpretation into a statically-typed multi-stage calculus. It is then easy to show that our macros are stage- and type-safe: macro expansion does not depend on runtime evaluation, and both stages do not ``go wrong''. Furthermore, these macros do not interfere with reasoning about the expanded program.




Other Videos By Microsoft Research


2016-09-05Dynamosaics: Dynamic Mosaics with Non-Chronological Time
2016-09-05Automatic Failure Diagnosis in Large-Scale Systems
2016-09-05The Economics of Software Dependability
2016-09-05An Overview of Recent CMU Research on Model-Based Face Processing
2016-09-05Resource acquisition via an unsupervised WSD system
2016-09-05Fast Infinite-State Model Checking in Integer-Based Systems
2016-09-05WeΓÇÖre Friends, Right?: Inside KidsΓÇÖ Culture [1/4]
2016-09-05Accelerated Democracy: How technology might change voting
2016-09-05When Can Formal Methods Make a Real Difference?
2016-09-05Dynamic Semantics of Programming Languages and Applications to Testing
2016-09-05Type-Safe, Generative, Binding Macros
2016-09-05Social Network Analysis meets the Semantic Web: What FOAF Reveals About LiveJournal
2016-09-05Distributed Multi-robot Exploration and Mapping
2016-09-051.Vision: Extraordinary Computing Experiences & 2. Robots for the Masses: Fiction or Reality
2016-09-05Modeling and Facilitating Human Communication [1/5]
2016-09-05Reducing Errors in Computer Recognition of Handwritten Material
2016-09-05Information wants to be free (but is everywhere in chains)
2016-09-05The art and technology of electronic textiles
2016-09-05Quantum Loop Gas Approach to Topological Phases of Correlated Electrons
2016-09-05Computational History In Action: Discovering Gutenberg's Printing Process
2016-09-05A World Filled With Cameras: Security at the Cost of Freedom? Or Can We Have Both?



Tags:
microsoft research