Homoiconicity for Dummies

Expression trees are a form of data. More specifically, they are the data representation of a piece of code. It’s essential to see that expression trees do not contain the result of executing the code but capture the shape of the code itself. Compiler writers live and breathe such tree representations of code, starting with abstract syntax trees (ASTs).

Although expression trees are much like ASTs, they contain more information than just the syntax that lies at the origin of the expression tree. In addition, every node in an expression tree has reflective information about its data type and the operations it’s representing (like the precise method overload being called or property being looked up). All of this allows ...

Get C# 5.0 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.