http://d.puremagic.com/issues/show_bug.cgi?id=4277


changlon <chang...@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID


--- Comment #8 from changlon <chang...@gmail.com> 2010-06-28 20:45:28 PDT ---
IF I understood correct, the dwt.widgets.Listener design by Frank Benoit  is
danger in d1.  the source is:

------------------------------------------
module dwt.widgets.Listener;

import dwt.widgets.Event;
import tango.core.Traits;
import tango.core.Tuple;

public interface Listener {
void handleEvent (Event event);
}


/// Helper class for the dgListener template function
private class _DgListenerT(Dg,T...) : Listener {

    alias ParameterTupleOf!(Dg) DgArgs;
    static assert( is(DgArgs == Tuple!(Event,T)),
                "Delegate args not correct: delegate args:
("~DgArgs.stringof~") vs. passed args: ("~Tuple!(Event,T).stringof~")" );

    Dg dg;
    T  t;

    private this( Dg dg, T t ){
        this.dg = dg;
        static if( T.length > 0 ){
            this.t = t;
        }
    }

    void handleEvent( Event e ){
        dg(e,t);
    }
}

Listener dgListener( Dg, T... )( Dg dg, T args ){
    return new _DgListenerT!( Dg, T )( dg, args );
}

-- 
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to