#+title: Concepts * [[./dhamma.org][Dhamma]] A dhamma is anything that can "occur"; think of them as encompassing "functions", "events", "systems" and the like. ** Fields A dhamma has the following fields: - =name=: This is the /type/ of the dhamma; it encodes the /meaning/ of the dhamma, meaning /what actually happens/ when this dhamma occurs. - =data=: Data held by the dhamma; a generic field. - =meta=: Metadata for the dhamma; this is used when we need to encode data about /how a dhamma is executed/, whereas the - =data=: field encodes what a dhamma is executed /on/. - =asp-props=: /Aspect properties/; these are used to encode which dhamma are /aspects of/ this dhamma. Think of them as categories; one dhamma keeps a list of its aspect properties, and other dhammas track which aspect properties they "subscribe" to. See also [[file:./dhamma.org::*Aspects][Aspects]]. - =is-aspect-of?=: A function which takes as arguments this very =dhamma= and a =parent= and returns whether this =dhamma= should be considered an aspect of =parent=. This is used to apply more fine-grained filtering of aspects /after/ checking aspect properties. - =transient=: A boolean that is true when a dhamma should occur as an aspect only once, and false when it should keep reoccurring until it is explicitly removed. ** Implementation A dhamma's /implementation/ is a function which takes itself and optionally a =parent= and actually executes whichever action the dhamma stands for. ** Aspects Aspects are dhamma; when we say a dhamma is an aspect of another, we mean that the /aspect/ dhamma occurs in the context of a /parent/ dhamma, occurring after the implementation of the parent and with access to the data of its parent. Aspects serve the role of allowing /composition/ of dhamma. Allowing this composition to happen dynamically is a core feature of the engine.