← Back to team overview

kicad-developers team mailing list archive

Re: wxWidgets Event Tables or Bind and lambdas

 

We already have a lot of classes which use both.

FWIW, the wxWidgets folks encourage Bind.

As for lamdas, I think they’re pretty rare (for this use) in the code at present.  But they do appear to result in a higher signal-to-noise ratio for very short handlers.

While we’re on the subject, we have a lot of lamdas which use K&R style opening braces.  Are we OK with that, or should they be consistent with functions, blocks, etc.?

Cheers,
Jeff.

> On 12 Jul 2019, at 10:46, Simon Richter <Simon.Richter@xxxxxxxxxx> wrote:
> 
> Hi,
> 
> On Fri, Jul 12, 2019 at 11:11:21AM +0200, Ian McInerney wrote:
> 
>> Other windows seem to use the Bind method with lambda functions for these
>> small functions, and I have used them as well for some new bindings for the
>> actionization when needed. My main question is, is it acceptable to also
>> transition existing events (unaffected by the action changes) to use this
>> paradigm?
> 
> Which registration method is used is completely internal to the class that
> handles the events -- the same file contains both the registration and the
> handlers. IMO, it should be consistent within one file (i.e. if there is a
> table, it should be complete and not be augmented with additional runtime
> bindings), but beyond that it doesn't really matter.
> 
> wxWidgets 3.0 generates a few warnings about initialization order of static
> objects on MSVC when we're using tables, but these seem to be both harmless
> and fixed with wxWidgets 3.1.
> 
>   Simon
> 
> _______________________________________________
> Mailing list: https://launchpad.net/~kicad-developers
> Post to     : kicad-developers@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~kicad-developers
> More help   : https://help.launchpad.net/ListHelp



Follow ups

References