Re: Introducing "Array Of" RFC

From: Date: Mon, 20 Jan 2014 21:11:01 +0000
Subject: Re: Introducing "Array Of" RFC
References: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18  Groups: php.internals 
Request: Send a blank email to internals+get-71355@lists.php.net to get a copy of this message
Hi! > This RFC optionally allows developers to say: > > 3. "Give me a bag of spanners, and break if they put anything else in there." > Note that neither generics nor array strict typing gives you that. Neither of them can control what is being put into the bag. The only thing you can do is to look in the bag and reject what has been put there post-factum (actually, with generics you can't do even that - generics parametrize you types, but you still have to have the typechecks somewhere, so from type checking point generics change nothing) - i.e. the check happens not when something is put in the bag but when you get the bag and you have to examine that bag (every single time you touch it) and pull out each element of it and ensure it is still a spanner. If you put the bag down, next time you touch it you have to pull out every single thing out of the bag and check if it is a spanner *again*. Is it really the bag you want to deal with? I wouldn't really want to own such bag, I'm not OCD enough for that :) -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/ (408)454-6900 ext. 227

« previous php.internals (#71355) next »