[haXe] Constraint Parameters - unexpected behaviour

Zjnue Brzavi zjnue.brzavi at googlemail.com
Fri Jan 5 01:47:26 CET 2007


Hi Nicolas and List,

Constraint parameters as defined at
http://www.haxe.org/ref#constraint_parameters
do not seem to be working as advertised. Please note:

class TestConstraintParams {
	static function main() {
		var a = new Test1<B>();		//errs: Invalid number of type parameters for Test1
		var b = new Test1<B,B>();	//works
	}
}
class A {
}
class B extends A {
	public function new() {
	}
}
class Test1<T:A,B> {
	public function new() {
	}
}

It appears the second 'constraint parameter' in Test1 is seen as a
second class type parameter instead. Has the intention of the syntax
changed? I'm interested to define multiple type paramteres for a
class, while also defining multiple constraint parameters for some of
the class type parameters. Is this possible? If so, please advise on
the correct syntax.

Many thanks,

Zjnue



More information about the Haxe mailing list