Hi,

the attached source file fails to compile with:

foo.vala:19.34-19.46: error: Argument 1: Cannot convert from
`myIntCallback' to `GenericClass.Callback'
        var gc = new GenericClass<int>( myIntCallback );
                                        ^^^^^^^^^^^^^

Apparantly, Vala does not recognize the equality of the generic
and the concrete type. Is there any way to work around that?

Cheers,

:M:

public class GenericClass<T>
{	
	public delegate void Callback( T element );
	private Callback cb;

	public GenericClass( Callback cb )
	{
		this.cb = cb;
	}
}

public void myIntCallback( int element )
{
	message( @"$element" );
}

void main()
{
	var gc = new GenericClass<int>( myIntCallback );
}
_______________________________________________
Vala-list mailing list
[email protected]
http://mail.gnome.org/mailman/listinfo/vala-list

Reply via email to