Re: [Vala] anonymous functions





2008/7/15 Sam Liddicott <sam liddicott com>:
* Jared Moore wrote, On 15/07/08 10:40:

And in the advanced example:
http://live.gnome.org/Vala/AdvancedSample


what does the s signify in

       this.foo += s => {
           stdout.printf ("Lambda _expression_ %s!\n", name);
       };

    
's' is the formal parameter of the function, just like s and p are
formal parameters in the first example. You could put parentheses
around it if you like, but you don't need to because in that case
there's only one parameter.
  
Thanks.

In that example do you know what s signifies?  - The signal foo doesn't seem to take any parameters.

Hi,

Signal handler always have the "signal sender" as 1st parameter, in this case it would be the AdvancedSample instance from which the "foo" signal originated.

I proposed the "sender" keyword inside signal handler context (just like the "this" keyword inside the object instance context) to eliminate this confusing parameter a while ago, but it didn't seem like a good idea for many people.

--
Ali



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]