Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:78373 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 6380 invoked from network); 27 Oct 2014 07:04:15 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 27 Oct 2014 07:04:15 -0000 Authentication-Results: pb1.pair.com smtp.mail=pthreads@pthreads.org; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=pthreads@pthreads.org; sender-id=unknown Received-SPF: error (pb1.pair.com: domain pthreads.org from 74.125.82.48 cause and error) X-PHP-List-Original-Sender: pthreads@pthreads.org X-Host-Fingerprint: 74.125.82.48 mail-wg0-f48.google.com Received: from [74.125.82.48] ([74.125.82.48:51637] helo=mail-wg0-f48.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 65/B7-56216-E6EED445 for ; Mon, 27 Oct 2014 02:04:15 -0500 Received: by mail-wg0-f48.google.com with SMTP id m15so3001373wgh.7 for ; Mon, 27 Oct 2014 00:04:12 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:message-id:subject:from:to:cc:date:in-reply-to :references:content-type:mime-version:content-transfer-encoding; bh=VXXdOiWwb8xilNqf/Fubj1qbNVp5Y9gCo89zLqIrODQ=; b=lX3AHKtHzDNbtzcBXoJzePjyR/q5HdDLxpc02CFdtuK7C2CcNOPD7lRHrPrb6opFfB GneDyujTAxs4i5QygtrAqd0YNDYamLxkJdPHNY5la/y8UjehptZDoyEFIGfmZXHzga/G re6aHuc3SAsIPBoOCPWgwx/wQy3mqe7XQSqz8UPTLvnqOONyfrGApzow8qMnfIZR2xkq 611fnFau7Kjp1JP7V7yS2QeZLDUuBP7ut2JfwhrhfuELeNVON2OKzs6IzNycNtZybksc aGQQkm0zQZ3us4Zj/Lk7+34V0+aJJO4xa9gwun5tsp35qYFmkekfEsVFVlVdUWpBCgl4 eHMg== X-Gm-Message-State: ALoCoQm/pPG8TPJvMawg7jv04wnF6t+S3b1iWCv2zA5KPbzgmAnovqqCIK4xVSQkzgXvYIu3frwR X-Received: by 10.180.93.233 with SMTP id cx9mr19099903wib.48.1414393452032; Mon, 27 Oct 2014 00:04:12 -0700 (PDT) Received: from [192.168.1.67] (host86-130-70-156.range86-130.btcentralplus.com. [86.130.70.156]) by mx.google.com with ESMTPSA id td9sm10808516wic.15.2014.10.27.00.04.10 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 27 Oct 2014 00:04:11 -0700 (PDT) Message-ID: <1414393449.2624.141.camel@localhost.localdomain> To: Stas Malyshev Cc: PHP Internals Date: Mon, 27 Oct 2014 07:04:09 +0000 In-Reply-To: <544DE7FF.6030809@gmail.com> References: <544DA1CD.9070109@php.net> <1414388245.2624.135.camel@localhost.localdomain> <544DE7FF.6030809@gmail.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.10.4 (3.10.4-4.fc20) Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC] Using objects as keys From: pthreads@pthreads.org (Joe Watkins) On Sun, 2014-10-26 at 23:36 -0700, Stas Malyshev wrote: > Hi! > > > It seems __toScalar might be a good name, this is what the method > > actually does, the engine then coerces to a type suitable for use as a > > key, but you can return a double. It might be more forward thinking > > therefore to use the name __toScalar, while today we'd only be using > > it for this, > __toScalar does not express the fact why we are calling it - to use it > as a key. It's not just a scalar conversion, it's conversion for the > purpose of hashing. > Morning Stas, True, I was just thinking that the next time we need to represent an object as a scalar for whatever reason we might end up having to add another magic method. It's easy enough to document that __toWhatever is used in the context we intend to use it in. Not super bothered about it ... it's obviously a +1 from me whatever the name. About restricting to signed/unsigned ints ... this doesn't seem sensible, the PHP programmer doesn't care about signs, or types. It makes sense to allow the programmer to return anything we would currently coerce to a valid key, don't think that needs to change. Cheers Joe