docs: Document the new typeof() operator

This commit is contained in:
James Westman 2022-11-26 16:44:43 -06:00
parent 46a06bb7b6
commit d8f1b41ef0
No known key found for this signature in database
GPG key ID: CE2DBA0ADB654EA6

View file

@ -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 <https://docs.gtk.org/gobject/alias.Type.html>`_, that is, their value is
itself a description of a type in the GObject type system. An example is
`Gio.ListStore:item-type <https://docs.gtk.org/gio/property.ListStore.item-type.html>`_. 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
~~~~~~~~