Files
fpp/docs/spec/Definitions/Dictionary-Definitions.adoc
Rob Bocchino 4fc83d508d Revise spec
Add framework ports
Revise implied uses
Add a section on type definitions
2026-02-26 23:23:41 -08:00

40 lines
1.1 KiB
Plaintext

=== Dictionary Definitions
If the optional keyword `dictionary` appears in a
<<Definitions_Type-Definitions,type definition>> or
a <<Definitions_Constant-Definitions,constant definition>>, then that
definition is called a
*dictionary definition*.
A dictionary definition instructs the code generator to include
the definition in the ground dictionary.
==== Semantics
If a constant definition _D_ is a dictionary definition, then the
expression appearing in _D_ must have one of the following types:
* A <<Types_Internal-Types_Numeric-Types,numeric type>>.
* The <<Types_The-Boolean-Type,Boolean type>>.
* A <<Types_String-Types,string type>>.
* An <<Types_Enum-Types,enum type>>.
If a type definition _D_ is a dictionary definition, then the type
defined by _D_ must be a <<Types_Displayable-Types, displayable type>>.
==== Examples
[source,fpp]
----
dictionary type T = U32
dictionary array A = [3] string
dictionary constant a = 0
enum E { X, Y }
dictionary constant b = E.X
type T1
dictionary type T2 = T1 # Error: T2 is not displayable
dictionary constant c = { x = U32 } # Error: struct type is not allowed
----