Class Symbol Table

Use a class and its fields to implement a symbol table in order to support type-aware autocompletion in a statically typed language.

Modern IDEs provide lots of powerful and compelling features to make programming easier. A particularly useful one is type-aware autocompletion. In my C# and Java IDEs, I can type the name of a variable, type the period, and get a list of all the methods that are defined on that object. Even people like me who enjoy dynamically typed languages have to admit that this is a benefit of statically typed languages. When working in an internal DSL, you don't want to give up this capability for typing the name of a symbol in the DSL. However, the most common ways of expressing DSL symbols are to use strings or a built-in symbol type—so there's no relevant type information.

Class Symbol Table allows you to make symbols statically typed in the host language by defining each symbol as a field in a Expression Builder .

For more details see chapter 44 of the DSL book

| Catalog of DSL patterns |