Chapter 40. Literal Map

Represent an expression as a literal map.

image

40.1 How It Works

A Literal Map is a language construct, present in many languages, that allows you to form a map data structure (also known as a dictionary, hashmap, hash, or associative array). It’s normally used in a function call where the function takes the map and processes it.

The biggest problem with using a Literal Maps in a dynamically typed language is the lack of a way to communicate and enforce the valid names for the keys. In addition to the fact that you’ll have to write code to handle unfamiliar keys yourself, there’s no mechanism to indicate to the DSL script ...

Get Domain Specific Languages now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.