Contents

images About the Author

images About the Technical Reviewer

images Acknowledgments

images Introduction

Part 1 images DLR Fundamentals

images Chapter 1: Introduction to DLR

Setting Up Code Examples

Software Requirements

Installing the DLR, IronPython, and IronRuby

Hello World Examples

Implementing REPL for the Hello Language

Practical Uses for the DLR

Application Scripting and DSL

XML Builder

Aspect-Oriented Programming

Runtime

Runtime vs. Run Time

Run Time vs. Compile Time

Dynamic vs. Static

Dynamic Typing

Dynamic Dispatch

Language

Programming Languages in Practice

Putting It Together

Summary

images Chapter 2: DLR Expression

DLR Expression as a Language

Code as Data  

A Common Denominator like CLR

Concrete Syntax and Serialization

Expressions vs. Statements

Expression Type and Kind

Binary Expressions

Flow Control Expressions

If-Then-Else Expressions

Switch Expressions

Scopes and Name Binding

Lexical vs. Dynamic Scope

BlockExpression and Lexical Scoping

Lambda Expressions and Closure

The GotoExpression Class

While Loops

Dynamic Expressions

Index Expressions

Expression Abstraction, Reduction and Extension

Immutability and the Visitor Pattern

Visitor Pattern in General

Visitor Pattern in DLR Expression

Expression Visitor Examples

Summary

images Chapter 3: Late Binding and Caching

Binding

Call Sites and Early Binding

Call Sites and Late Binding

DLR Binders

Set Up Code Examples

Making a Debug Build of the DLR for .NET 2.0

Developing for Both .NET 2.0 and .NET 4.0

The CallSiteBinder Class

DLR Call Sites

Binding Restrictions and Rules

Checking Binding Rules in Debug Mode

Caching

Three Cache Levels

Late-Binding Context

L0 Cache Example

L1 Cache Example

L2 Cache Example

Creating Canonical Binders

Summary

images Chapter 4: Late Binding and Interoperability

Language Interoperability

Static and Dynamic Objects

Late-Binding Logic in Two Places

Late Binding Logic in Binders

Late-Binding Logic in Dynamic Objects

Late-Bound Actions

Examples

Common Type System

Class Hierarchy of Binders

Implement a Custom Binder Class

Interoperability Protocol

Summary

images Chapter 5: Dynamic Objects

What is a Dynamic Object?

IDynamicMetaObjectProvider Interface

Dynamic Meta Objects

DynamicMetaObject and Binding Logic

DynamicMetaObject and Binding Result

Interoperability

DynamicObject Class

XML Builder

Summary

images Chapter 6: DLR Hosting API

Life Without the DLR Hosting API

Using a Static Language’s Code in Another Static Language

Using a Static Language’s Code in a Dynamic Language

Using a Dynamic Language’s Code in a Static Language

Using a Dynamic Language’s Code in Another Dynamic Language

Overview of the DLR Hosting API

Major Classes in the API

The Tale of Two APIs

The DLR Hosting API in Relation to Binders and Dynamic Objects

Using Script Runtime to Execute Code

Configuring the Languages You Want to Speak

Configuring Script Runtime Declaratively

Configuring Script Runtime Programmatically

Scripting an Object Model

Script Scopes

Value and Reference Variables

Global Scope and Variable Passing

Language Neutral Scope and Variable Passing

Level Two Use of the DLR Hosting API

Compiling Code

Loading Assemblies into Script Runtime

Creating Python Class Instances Using Object Operations

Level Three Use of the DLR Hosting API

Script Host

Object Operations

Remote Script Runtime

.NET Remoting Quick Tour

Running Script Runtime in a Separate Process

Summary

Part 2 images Applying the DLR

images Chapter 7: DLR and Aspect-Oriented Programming

Aspect-Oriented Programming

Cross-Cutting Concerns

Advice, Join Points, and Pointcuts

An Example

A Test Run

AOP for Dynamic Objects

Understanding the Framework

Implementing the Framework

Integration with Spring.NET AOP

Getting the AOP Advisors

Implementing Advice

Applying Advice

Cutting Across Dynamic and Static Objects

Summary

images Chapter 8: Metaprogramming

Overview of Metaprogramming

Changing Class Definitions

Ruby

Python

DLR

LINQ Query Provider

Understanding the End Goal

Implementing the Query Class

Implementing the QueryProvider Class

Implementing QueryExpressionVisitor

Data Access

Static Data Access

Dynamic Data Access

Generated Data Access

Summary

images Chapter 9: Stitch — A DSL for Hosting Languages

The Need for Stitch

Syntax of the Stitch Language

Requirements for the Example

Software Requirements

Organization of the Code

Stitch in Use

Being Declarative

Hosting DLR- and Non-DLR-Based Languages

Hosting Stitch Itself

Executing in Parallel

Stitch Language Grammar

Setting Up Eclipse and ANTLR

Defining the Grammar

Test-Driving the Grammar

The Stitch Runtime

Overview of the Runtime

The Script Engine

Function Execution Coordinator

Parallel Extensions for .NET

Script Runner

Running DLR-based Language Code

Language Plug-In

Develop a Stitch Plug-In for PowerShell

Configuring a Plug-In

Summary

images Chapter 10: Application Scripting

Ball World

Software Requirements

Application Architecture

Application Object Model

Application Scripting

The Physics Engine

User Interface

Summary

images Chapter 11: DLR in Silverlight

Different Client Side Web Scripting Approaches

Apache HTTP Server Configurations

Using the Hosted Gestalt Components

Hosting the Gestalt Components

Dissecting the Gestalt Components

Scripting HTML

Scripting XAML

DLR Settings

Speak Your Own Language in Silverlight

Software Requirements

Build DLR for Silverlight

The Hello Language

Hello Console in Silverlight

Gestalt-like Hello Console on Silverlight

Summary

images Chapter 12: Dynamic Languages on JVM

Quick Comparisons

Python and Ruby on JVM

Hosting Python Code in Java Programs

Hosting Ruby Code in Java Programs

Overview of the BoolScript Example

BoolScript Language

Script Engine Factory

Script Engine Discovery Mechanism

Bindings, Scope, and Context

BoolScript Engine

Compile BoolScript Code

Run BoolScript Code as Invocable Function

Summary

images Index

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

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