Introduction

The book you're holding focuses on Microsoft's Dynamic Language Runtime (DLR) and what it can do for you in your day-to-day programming work. Many think the DLR is an esoteric platform that matters only if you happen to be one of the very few who are implementing languages such as Python and Ruby atop the .NET Framework. That belief is far from the truth. The DLR puts a number of exciting capabilities at your disposal. Implementing languages is actually pretty far down on that list.

One of the most obvious things to do with the DLR is to mix and match code and objects from different languages. Do you have an object in Python that does what you need? Use the DLR to make that object usable from your C# code.

Going further, you can mix and match dynamic and compiled languages in ways that are convenient, that allow you to choose the best tool for the job at hand within your overall application. This ability to mix and match leads directly to using dynamic languages as scripting languages within your applications. Going even further, you can dive in and make the DLR your basis for implementing application- and domain-specific scripting languages.

Aspect-oriented programming and runtime code generation are two other techniques made possible by the DLR. You'll find examples of both in this book. You'll also find clear examples that show the details of using the DLR. You'll learn about core components such as LINQ expressions, call sites, binders, and dynamic objects. You'll see how to apply those components to the problem of combining dynamic and compiled languages into a single application. You'll end up with the ability to apply whatever language or language-library is most productive given the programming problem you're trying to solve at any given moment. You'll truly be able to apply the best tool to the job at hand.

Prerequisites

Chapter 1 describes the prerequisites in detail, explaining the software you need to install in order to mimic my own configuration so you can run the examples in this book. In general, though, you should be comfortable programming in C#. You should also know at least one of the common scripting languages, such as Python or Ruby. If you can compile and run a C# program and you can execute Python or Ruby code, you have what it takes to get the most out of this book.

Structure of the Book (or How this Book is Organized…)

This book consists of two parts:

Part I deals with the fundamentals. You are introduced to the DLR, and to the core functionality that the API provides. This is where you'll learn the mechanics of using the DLR.

Part II explores applying the DLR to various ends. You'll find chapters devoted to such topics as aspect-oriented programming, application scripting, domain-specific languages, meta-programming, and more.

Part I consists of six chapters. Chapter 1 stands out in that it gives you a whirlwind tour — code included! — showing all you can accomplish using the DLR. If you want to get the lay of the land, to know what the possibilities are, Chapter 1 is what you should read. Chapters 2-6 then go into detail on the various mechanics of using the DLR.

Part II also consists of six chapters. Here the emphasis is on applying the DLR to specific programming techniques. You'll begin, for example, by learning how the DLR helps enable aspect-oriented programming. You'll be introduced to STITCH, a domain-specific language implemented atop the DLR that makes it easier to host languages such as Python and Ruby from within your C# programs. And you'll learn about metaprogramming, application scripting, and how to run DLR applications on the Silverlight platform.

Obtaining the Source Code

Source code is available for the examples shown in this book. You can download that source code from the book's catalog page on the Apress web site. Here is the URL for that page:

http://apress.com/book/view/1430230665

Once there, look under the book's cover image for the catalog page section entitled “Book Resources,” where you'll see a link for “Source Code.” Click that link to download a zip archive containing the example code for this book.

When you have the download, refer to Chapter 1. There you'll find instructions on setting up the code examples. You'll also find a description of the directory structure used in the example archive.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.93.141