9
BEHIND LINQ – AND BEYOND Mads Torgersen, Microsoft

Mads Torgersen, Microsoft. Language INtegrated Query An open multi-language query facility Uses cool language stuff Points into the future

Embed Size (px)

Citation preview

Page 1: Mads Torgersen, Microsoft.  Language INtegrated Query  An open multi-language query facility  Uses cool language stuff  Points into the future

BEHIND LINQ – AND BEYONDMads Torgersen, Microsoft

Page 2: Mads Torgersen, Microsoft.  Language INtegrated Query  An open multi-language query facility  Uses cool language stuff  Points into the future

LINQ

Language INtegrated Query An open multi-language query facility

Uses cool language stuff Points into the future

Page 3: Mads Torgersen, Microsoft.  Language INtegrated Query  An open multi-language query facility  Uses cool language stuff  Points into the future

WHAT LANGUAGE STUFF?

Declarative More “what”, less “how” Higher order functions Type inference Comprehensions

Metaprogramming Expression trees

Page 4: Mads Torgersen, Microsoft.  Language INtegrated Query  An open multi-language query facility  Uses cool language stuff  Points into the future

DEMO

Page 5: Mads Torgersen, Microsoft.  Language INtegrated Query  An open multi-language query facility  Uses cool language stuff  Points into the future

EXPRESSION TREES

Language neutral

Expressions now Statements soon Declarations and programs later?

Strongly tied to reflection now Runtime independent later?

Page 6: Mads Torgersen, Microsoft.  Language INtegrated Query  An open multi-language query facility  Uses cool language stuff  Points into the future

DYNAMIC LANGUAGE RUNTIME (DLR)

API for efficient dynamic lookup

No special CLR (it’s the VM ) support

Caching via ETs and runtime code generation

Page 7: Mads Torgersen, Microsoft.  Language INtegrated Query  An open multi-language query facility  Uses cool language stuff  Points into the future

HOW THE DLR WORKS

Call sites cache a delegate which does the dispatch

Slow path is (caller) language specific. Typically1) Ask the receiver object if it wants to lookup2) If not, use language binding rules on runtime

type3) Either way, return rule and meaning ETs4) Patch up dispatch ET with new case5) Compile ET and install in call site

Page 8: Mads Torgersen, Microsoft.  Language INtegrated Query  An open multi-language query facility  Uses cool language stuff  Points into the future

THE FUTURE?

Dynamic languages and features IronPython, IronRuby Dynamic lookup in other languages?

Functional languages and features F# Mutability tracking? Pattern matching?

Parallelism Plinq, Parallel Extensions and beyond

Metaprogramming More compiler in APIs? More API in compilers?

Page 9: Mads Torgersen, Microsoft.  Language INtegrated Query  An open multi-language query facility  Uses cool language stuff  Points into the future

?