Re: Generic classes and methods RFC

From: Date: Sat, 12 Sep 2015 10:24:46 +0000
Subject: Re: Generic classes and methods RFC
References: 1 2  Groups: php.internals 
Request: Send a blank email to internals+get-88162@lists.php.net to get a copy of this message
Am 12.09.2015 um 12:03 schrieb Dennis Birkholz: > Hi together, > > 1. If we require some keyword instead of the colon to limit which types > the type placeholders can have I would choose: > class Foo<T1 instanceof Bla, T2 instanceof Blubb> {} Just to save you some lookups in the Hack documentation: 1. Hack uses the "as" keyword: class Foo<T1 as Bla> {} 2. It does not allow to require multiple types for T1: "Currently, Hack only allows one constraint on a type or a method." 3. I found no example that Hack allows multiple type parameters like class Foo<T1, T2> but also nothing that it is not possible 4. All type parameters must start with a capital T 5. Hack has generic methods 6. Hack has generic traits which we should also consider/specify how they work exactly. Greets Dennis

« previous php.internals (#88162) next »