From d8f1b41ef07057f35de135ef9e8a40ae51a9741d Mon Sep 17 00:00:00 2001 From: James Westman Date: Sat, 26 Nov 2022 16:44:43 -0600 Subject: [PATCH] docs: Document the new typeof() operator --- docs/examples.rst | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/docs/examples.rst b/docs/examples.rst index 9b123d2..13b97a8 100644 --- a/docs/examples.rst +++ b/docs/examples.rst @@ -161,6 +161,26 @@ Defining object properties inline Note the semicolon after the closing brace of the ``Gtk.Adjustment``. It is required. +Type Literals +~~~~~~~~~~~~~ + +Some properties have the type `GObject.Type `_, that is, their value is +itself a description of a type in the GObject type system. An example is +`Gio.ListStore:item-type `_. Such properties can be +specified with the ``typeof()`` operator: + +.. code-block:: + + Gio.ListStore { + item-type: typeof(.MyDataModel); + } + +.. note:: + + Though it looks like a function, ``typeof()`` is actually a special operator. This is an important syntactic + distinction because the argument to ``typeof()`` is interpreted at the grammar level as a type, not a value or + expression. + Bindings ~~~~~~~~