Hey all,

2009/12/1 OvermindDL1 <[email protected]>:
>> On Tue, Dec 1, 2009 at 10:15 AM, hadass yaari <[email protected]> wrote:
>> And I honestly have no clue why Wt uses that nasty, useless SLOT macro
>> either, you *should* just be able to do this since connect just need a
>> nullary function to call, who cares if it is a function pointer, a
>> functor, or any callable, it should just simplify things and just take
>> a Boost.Function, which can accept and use it all (and which it so
>> happens that the under-the-scenes Boost.Signals happens to take, thus
>> Wt is creating some Binds when it is not necessary (wasting time and
>> memory), and just making things all around more difficult then just
>> taking a simple TR1/Boost.Function).
>> pb->clicked().connect(boost::bind(&AddPersonAuto::bla,this,5));

It has indeed been a long time since we implemented the Wt signal
interface. I think it is a straightforward change to also support a
generic template function object, next to the current connect methods.

The current syntax, with an explicit reference to the target object,
does however allow us to implement the stateless slot learning for
EventSignal, and for that reason alone I think we should not make the
template syntax the default.

The SLOT macro is there for historical reasons (there was a time that
Wt used a Qt-like moc preprocessor), and it indeed does not really
contribute anything.

> I really mean this too, for example, what if I want to do something like this:
> pb->clicked().connect(let(_a=ref(theTest))[if_(_a>0)[bind(AddPersonAuto::bla,val(this),_a++),bind(AddPersonAuto::differentBla,this,_a),--ref(theTest)]]);
>
> To PrettyPrint that from above:
> pb->clicked().connect(
>    let(_a=ref(theTest))
>    [
>        if_(_a>0)
>        [
>            bind(AddPersonAuto::bla,val(this),_a++),
>            bind(AddPersonAuto::differentBla,this,_a),
>            --ref(theTest)
>        ]
>    ]
>    );
>
> Which would be the same thing as this:
> void AddPersonAuto::doAction(void)
> {
>    int a = theTest;
>    if(theTest>0)
>    {
>        bla(a++);
>        differentBla(a);
>        --theTest;
>    }
> }
> pb->clicked().connect(SLOT(this, AddPersonAuto::doAction));
>
> Which is of course a *lot* more wordy (and yes I know the example is
> not the best designed, I am just showing some programming styles I
> use, and yes, that is valid C++).

I happened to have read that the latest gcc release has c++0x lambda
support. Have you any experience with it? I sure hope it will look a
lot nicer than this Boost.Lambda hack :-)

> But I cannot do that because of the rather horrible way the
> Wt::Signals class was designed, instead of being generic, it is broken
> in the useful cases...

But it can easily be fixed.

> Yes, if you cannot tell, I have no clue why the connect function was
> designed so, rather horribly, and yes it has been bugging me more and
> more as time goes on...

A solution is only a patch away !

> I just found out, that will not help, because whoever designed the
> connect method did the stupid thing of doing things like:
>  template<class T, class V>
>    boost::signals::connection connect(T *target, void (V::*method)());
>  template<class T, class V>
>    boost::signals::connection connect(T *target, void (V::*method)(A1));
>  template<class T, class V>
>    boost::signals::connection connect(T *target, void (V::*method)(A1, A2));
>
> And overloading it for each possible amount of variables (up to a
> limit, not that high of a limit either), rather then just making it
> generic, as would be expected and much more useful (and not require
> that blasted SLOT macro at all, horrible design that macro is).

The macro does not really do anything, does it? By all means, it is
not required in the current design.

I've made a ticket on redmine: http://redmine.webtoolkit.eu/issues/show/201

Regards,
koen

------------------------------------------------------------------------------
Join us December 9, 2009 for the Red Hat Virtual Experience,
a free event focused on virtualization and cloud computing. 
Attend in-depth sessions from your desk. Your couch. Anywhere.
http://p.sf.net/sfu/redhat-sfdev2dev
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest

Reply via email to