Re: [PHP-DEV] Generics proposal

2012-10-22 Thread Levi Morrison
>> Especially if the ability was afforded to arrays as well (function >> foo(array $array){})... > > This would require O(n) runtime tests, I would definitely not go there. Actually, it does not require O(n) runtime tests. The solution is simple: store the type when it is created. Whenever an ele

Re: [PHP-DEV] Generics proposal

2012-10-22 Thread Johannes Schlüter
On Tue, 2012-10-23 at 00:57 +0200, Christian Schneider wrote: > > Basically it means that you type more (redundant) stuff to allow the > compiler to check some errors. Which we can't do due to PHP's dynamic nature. For the engine to take benefit from it we'd have to change the language. All we d

Re: [PHP-DEV] Generics proposal

2012-10-22 Thread Christian Schneider
Am 22.10.2012 um 21:44 schrieb Anthony Ferrara : > This is not about turning PHP into Java. Can we get over that old rhetoric > already? Instead of bashing proposals like this, can we discuss them, > instead of this hatred for all things strict? > > With that aside, I have mixed feelings on this.

Re: [PHP-DEV] Generics proposal

2012-10-22 Thread Etienne Kneuss
Hi, On Mon, Oct 22, 2012 at 9:44 PM, Anthony Ferrara wrote: > Stas, > > On Sun, Oct 21, 2012 at 12:51 PM, Stas Malyshev wrote: > >> Hi! >> >> > Hello, list. I want to propose generics. >> >> Please no. If you need Java, you know where to find it. Java has a set >> of great tools, great books, gre

Re: [PHP-DEV] Generics proposal

2012-10-22 Thread Anthony Ferrara
Stas, On Sun, Oct 21, 2012 at 12:51 PM, Stas Malyshev wrote: > Hi! > > > Hello, list. I want to propose generics. > > Please no. If you need Java, you know where to find it. Java has a set > of great tools, great books, great community. And it's completely free. > Anybody who needs Java can just

Re: [PHP-DEV] [RFC] Accessors : read-only / write-only keywords

2012-10-22 Thread Chris van Dam
Dear internals, I really like the way Nikita describes the implementation. It is very consistent and easy to read. At least for me it is. I must say I'm very excited to see this implementation coming to PHP Kind regards, Chris van Dam Op 20-10-12 11:52 schreef Nikita Popov : >On Sat, Oct 20,

Re: [PHP-DEV] Generics proposal

2012-10-22 Thread jpauli
On Sat, Oct 20, 2012 at 10:59 PM, Nikita wrote: > Hello, list. I want to propose generics. For those, who don't know what it > is, here's example: say we have a Comment class, that has a method getBody. > Also we have Collection class, that implements Traversable. Now, if I want to > validate a

Re: [PHP-DEV] Generics proposal

2012-10-22 Thread Amaury Bouchard
Nobody wants to turn PHP into Java. But, even if I agree for generics (or templates), I would like to know where is the border line. Classes, exceptions, interfaces, traits, type hinting in parameters => OK Type hinting in object properties, type hinting of returned values, type templating => KO?