From 67ad727a0b5d9909ed4e80fc93691eee969d0200 Mon Sep 17 00:00:00 2001 From: Rico Tzschichholz Date: Thu, 15 Sep 2022 20:46:05 +0200 Subject: manual: Update from wiki.gnome.org --- doc/manual/manual.xml | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) (limited to 'doc') diff --git a/doc/manual/manual.xml b/doc/manual/manual.xml index 939824aa8..102e8681b 100644 --- a/doc/manual/manual.xml +++ b/doc/manual/manual.xml @@ -1128,7 +1128,7 @@
Delegates A delegate declaration defines a method type: a type that can be invoked, accepting a set of values of certain types, and returning a value of a set type. In Vala, methods are not first-class objects, and as such cannot be created dynamically; however, any method can be considered to be an instance of a delegate's type, provided that the method signature matches that of the delegate. -Methods are considered to be an immutable reference type. Any method can be referred to by name as an expression returning a reference to that method - this can be assigned to a field (or variable, or parameter), or else invoked directly as a standard method invocation (see Expressions/Invocation expressions). +Methods are considered to have an immutable reference type. Any method can be referred to by name as an expression returning a reference to that method - this can be assigned to a field (or variable, or parameter), or else invoked directly as a standard method invocation (see Expressions/Invocation expressions).
Types of delegate @@ -1141,17 +1141,13 @@ Delegate declaration The syntax for declaring a delegate changes slightly based on what sort of delegate is being declared. This section shows the form for a namespace delegate. Many of the parts of the declaration are common to all types, so sections from here are referenced from class delegates, interface delegates, etc. delegate-declaration: -instance-delegate-declaration - static-delegate-declaration - instance-delegate-declaration: [ access-modifier ] delegate return-type qualified-delegate-name ( method-params-list ) [ throws error-list ] ; - static-delegate-declaration: -[ access-modifier ] static delegate return-type qualified-delegate-name ( method-params-list ) [ throws error-list ] ; qualified-delegate-name: [ qualified-namespace-name . ] delegate-name delegate-name: identifier Parts of this syntax are based on the respective sections of the method declaration syntax (see Methods for details). +By default, delegates are instance delegates. To declare a static delegate, add the annotation [CCode (has_target = false)]; see the examples below. (Static delegates used to be declared by adding the keyword static before delegate instead of using the annotation. This syntax is still accepted by the compiler, but will cause a warning to be given.)
@@ -1163,13 +1159,15 @@
Examples Defining delegates: - + + - + + Invoking delegates, and passing as parameters. -- cgit v1.2.1