Dynamic internals. Introductions  Alexandru Ghiondea  C# Compiler QA  

Slides:



Advertisements
Similar presentations
Language Integrated Query (LINQ) Martin Parry Developer & Platform Group Microsoft Ltd
Advertisements

Using.NET Platform Note: Most of the material of these slides have been taken & extended from Nakov’s excellent overview for.NET framework, MSDN and wikipedia.
 Anders Hejlsberg Technical Fellow Microsoft Corporation TL16.
Ken Casada Developer Evangelist Microsoft Switzerland
What?!? C# Could Do That?? Shay Friedman CodeValue |
Visual Studio 2010 and.NET Framework 4 Training Workshop.
.NET Framework Overview Pingping Ma Nov 16 th, 2006.
ITEC200 – Week03 Inheritance and Class Hierarchies.
Case, Arrays, and Structures. Summary Slide  Case Structure –Select Case - Numeric Value Example 1 –Select Case - String Value Example  Arrays –Declaring.
C#.NET C# language. C# A modern, general-purpose object-oriented language Part of the.NET family of languages ECMA standard Based on C and C++
Run-Time Storage Organization
What’s New in C# 4.0? Pavel Yosifovich SELA Group
Gurinder CTO. Lisa Feigenbaum Microsoft Program Manager Visual Studio Languages
demo video demo Dynamic Languages Simple and succinctImplicitly typedMeta-programmingNo compilation Static Languages RobustPerformantIntelligent.
Louis de Klerk Consultant Inobits Consulting DTL308.
Windows.Net Programming Series Preview. Course Schedule CourseDate Microsoft.Net Fundamentals 01/13/2014 Microsoft Windows/Web Fundamentals 01/20/2014.
Comparison of OO Programming Languages © Jason Voegele, 2003.
It’s always better live. MSDN Events INTRODUCTION TO SILVERLIGHT prepared by Joe Nov INTRODUCTION TO SILVERLIGHT prepared by Joe Nov
Eric Vogel Software Developer A.J. Boggs & Company.
C# 簡介 靜宜大學資工系 蔡奇偉副教授 ©2011. C# 程式語言 C# (pronounced "see sharp") is a multi-paradigm programming language encompassing imperative, declarative, functional,
Lesley Bross, August 29, 2010 ArcGIS 10 add-in glossary.
C++ Code Analysis: an Open Architecture for the Verification of Coding Rules Paolo Tonella ITC-irst, Centro per la Ricerca Scientifica e Tecnologica
Nilotpal Bhattacharya Partner Technical Consultant| Microsoft.
JIT in webkit. What’s JIT See time_compilation for more info. time_compilation.
Dynamic Languages & The.Net Framework Shay Friedman ActionBase
New team member / new project for the team Helps analyze relationships and structure Understanding code Locates code in unfamiliar code bases Understand.
Alex Turner C# Compiler PM Session Code: DEV402 On the Dynamic menu today… The Dynamic Language Runtime How does it relate to the CLR? Dynamic in C#
 Jim Hugunin Partner Architect Microsoft Corporation TL10.
Mads Torgersen, Microsoft.  Language INtegrated Query  An open multi-language query facility  Uses cool language stuff  Points into the future.
Jan Benda Martin Maly Tomas Matousek Ladislav Prosek Pavel Novak Vaclav Novak Tomas Matousek Department of Software Engineering Faculty.
Irwin/McGraw-Hill Copyright© 2000 by the McGraw-Hill Companies, Inc. PowerPoint® Presentation to accompany prepared by James T. Perry University of San.
OOP and Dynamic Method Binding Chapter 9. Object Oriented Programming Skipping most of this chapter Focus on 9.4, Dynamic method binding – Polymorphism.
Created By: Kevin Cherry. A library that creates a display to run on top of your game allowing you to retrieve/set values and invoke methods.
C# EMILEE KING. HISTORY OF C# In the late 1990’s Microsoft recognized the need to be able to develop applications that can run on multiple operating system.
Lisa Feigenbaum Microsoft Program Manager Session Code: DEV314.
IronRuby for the.NET Developer Cory Foy - Cory Foy, LLC + + =
Other news? async and await Anonymous types (var, dynamic) Tuples Object instantiation Extension methods UCN Teknologi/act2learn1FEN 2014.
Introduction to C# By: Abir Ghattas Michel Barakat.
DEV394.NET Framework: Migrating To Managed Code Adam Nathan QA Lead Richard Lander Program Manager Microsoft Corporation.
Jonathan Aneja Program Manager Microsoft Corporation Session Code: DTL336 Anders Hejlsberg Technical Fellow Microsoft Corporation.
MIT-AITI: Functions Defining and Invoking Functions Functions as Data Function Scope: The call Object Function Arguments: The arguments objects Function.
Lap Around the.NET Framework 4 NameTitleCompany. A Look Back….NET 1.0.NET 1.1.NET NET CTP CLR 1.0 CLR 1.1 CLR 2.0 CLR.
C# Fundamentals An Introduction. Before we begin How to get started writing C# – Quick tour of the dev. Environment – The current C# version is 5.0 –
Luke Hoban Senior Program Manager Microsoft Session Code: DTL310.
© Copyright SELA software & Education Labs Ltd Baruch Hirsch St.Bnei Brak Israel 1 בס " ד.
Введение в DLR UNETA 16 апреля, 2010 Иван Колодяжный, Software Developer Teamdev Ltd.
Lucian Wischik SESSION CODE: DEV401. Advanced Use of the New Microsoft Visual Basic 2010 Language Features Lucian Wischik, VB spec lead.
Visual Studio 2010 and.NET Framework 4 Training Workshop.
INTRODUCTION BEGINNING C#. C# AND THE.NET RUNTIME AND LIBRARIES The C# compiler compiles and convert C# programs. NET Common Language Runtime (CLR) executes.
The language focusses on ease of use
Outline Introduction to the Phalanger System
/* LIFE RUNS ON CODE*/ Konstantinos Pantos Microsoft MVP ASP.NET
Jim Fawcett CSE681 – SW Modeling & Analysis Fall 2014
Jim Fawcett CSE681 – Software Modeling and Analysis Fall 2005
Upgrading Your C# Programming Skills to Be a More Effective Developer
Microsoft .NET 3. Language Innovations Pan Wuming 2017.
C# in the Big World Mads Torgersen Program Manager
Visual Studio 2010 and .NET Framework 4 Training Workshop
Learn. Imagine. Build. .NET Conf
Introduction to C# AKEEL AHMED.
.NET and .NET Core 5.2 Type Operations Pan Wuming 2016.
Programming in C# CHAPTER 1
.NET and .NET Core 9. Towards Higher Order Pan Wuming 2017.
Tech·Ed North America /18/2018 5:14 PM
Language Integrated Query (LINQ)
1.2 Key Concepts and Walkthroughs
Functional interface.
.Net Framework Details Imran Rashid CTO at ManiWeber Technologies.
Groovy.
Presentation transcript:

Dynamic internals

Introductions  Alexandru Ghiondea  C# Compiler QA    What is your programming language of choice?  Do your apps interop with COM? Do you use dynamic languages?  Have you seen C# 4.0 before?

C# 4.0 language features  Named and Optional parameters  Omit “ref” for COM calls  noPIA  Co&Contra Variance  Dynamic

Why dynamic?  There is a lot of interest in accessing the highly dynamic object model of HTML DOM  COM is heavily used and the interop code could be easier to read and write  Dynamic languages are becoming increasingly popular  We need a unified way to work with all of the above

Architecture Python Binder Ruby Binder COM Binder JavaScript Binder Object Binder Dynamic Language Runtime Expression Trees Dynamic Dispatch Call Site Caching IronPythonIronRubyC#VB.NETOthers…

How dynamic works  We have a new type called dynamic  Calls on variables of type dynamic are treated differently by the compiler  We package extra information about the call  Calls can be: Method calls, property access, indexer call, operator call  There is a C# runtime binder to interpret the information (at runtime)  It uses the runtime type for all dynamic arguments  It uses the compile time type for all other arguments

CLR How dynamic works (2) Exe CompileRun Bind call Expression Tree Dynamic Call Delegate DLR Cache COM Binder IronPython Binder C# Runtime Binder …

IronPython, PowerPoint and C#

Under the cover  What is the Dynamic type?  There is no dynamic type. There is only object!  What operations are supported?  A variable of type dynamic is assumed to support any kind of operation (method call, property access, operator call and indexer call)  How is the information about the call stored?  Using CallSites objects the compiler packages data about the call

What does a CallSite contain?  Information about the call being made  What type of call (method call, property, operator, etc)  The name of the member  The context of the call  The type arguments for the call  Information about the parameters and return types  Is it a constant, is it passed by-ref, etc

Dynamic and CallSites

Dynamic FAQ  When do you go dynamic?  When the target of the call or any of it’s parameters are dynamic  What is the return type of a dynamic call?  It is dynamic in most cases*  *What about conversions and constructors?  They are dispatched at runtime, but their return type is known at compile time

Dynamic FAQ (2)  What about private methods?  Information about the context of call is embedded in the CallSite allowing the Binder to “do the right thing”  Calling a method off a non-dynamic target with dynamic arguments. (c.M(d));  It works as expected!  Can dynamic “cross” assembly boundaries?  Yes, we decorate any dynamic parameter or return type with a DynamicAttribute  It works for generic types constructed with dynamic as well

Dynamic FAQ (3)  Can I use Named and Optional with dynamic?  Yes!  And also Co & Contra variance  Where can’t I use dynamic?  Lambda expressions  LINQ  Can’t use dynamic and method groups  throw or catch statements

Return type, private methods and generics

Build you own dynamic object  It’s simple!  Implement IDynamicObject  Derive from DynamicObject  Implements IDynamicObject

I want to be dynamic!!!

 C# 4.0 Samples and Whitepaper   Visual C# Developer Center   C# team member’s blogs on dynamic     Additional Resources