Metalinguistic abstraction

In computer science, metalinguistic abstraction is the process of solving complex problems by creating a new language or vocabulary to better understand the problem space. It is a recurring theme in the seminal MIT textbook Structure and Interpretation of Computer Programs, which uses Scheme, a dialect of Lisp, as a framework for constructing new languages.

Explanation

For example, consider modelling an airport inside a computer. The airport has elements like passengers, bookings, employees, budgets, planes, luggage, arrivals and departures, and transit services.

A procedural (e.g. C) programmer might create data structures to represent these elements of an airport and procedures or routines to operate on those data structures and update them, modelling the airport as a series of processes undergone by its various elements.

An object-oriented (e.g. C++) programmer might create objects to represent the elements of the airport with methods which represent their behaviors, modelling the airport as a collection, or series of collections, of possibly related things which characteristically interact with each other.

A functional (e.g. Scheme) programmer might create higher-order functions representing both the elements and behaviors or processes of the airport, modelling the airport as a map of relations between elements in its various domains and those in their assorted codomains.

Finally, a metalinguistic programmer might abstract the problem by creating new domain specific languages for modelling airports, with peculiar primitives and types for doing so. The new language could encompass any or all of the above approaches where most suitable.[1]

Because the creation of functional metalinguistic abstractions in non-functional languages can be cumbersome while the reverse is usually trivial, and also because of the syntactic flexibility and referential safety of functional macros, metalinguistic programming is mostly idiomatic of functional programming languages.

See also

References

  1. Structure and Interpretation of Computer Programs, Part 4 — Metalinguistic Abstraction
This article is issued from Wikipedia. The text is licensed under Creative Commons - Attribution - Sharealike. Additional terms may apply for the media files.