Re: [RFC][VOTE] Objects as Keys

From: Date: Tue, 16 Dec 2014 18:50:06 +0000
Subject: Re: [RFC][VOTE] Objects as Keys
References: 1 2 3 4 5  Groups: php.internals 
Request: Send a blank email to internals+get-79740@lists.php.net to get a copy of this message
Hi! > Explicit conversion is trivial, just call whatever method you like. > Sure, you can't write (int)$obj, but $obj->toInt() is just as > expressive. Exactly the same applies to __toString and whole ArrayAccess, yet we still have them. Avoiding boilerplate code helps. Especially if boilterplate code would look like: if(is_object($foo)) { $foo_key = $foo->toInt(); } else { $foo_key = $foo; } $a[$foo] = 1; Doing it each time is annoying. -- Stas Malyshev smalyshev@gmail.com

« previous php.internals (#79740) next »