[Interest] Most simple emit from singleton?

Jason H jhihn at gmx.com
Wed Nov 13 20:30:20 CET 2019


> 3) While signals are technically public members, I'd consider that an
> implementation detail; one should NEVER be emitting signals on behalf of
> another arbitrary class.
>
> You should protect your signal emissions, e.g. use the same undocumented
> trick that Qt uses (make them have an argument of type QPrivateSignal),
> and give friendship to the only codepaths that are supposed to emit it
> (and, even better, have a trampoline function that emits the signal that
> these codepaths can call).

These were some of the concerns that I had but failed to articulate as well.

Many thanks for the insights!



More information about the Interest mailing list