Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:103744 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 2340 invoked from network); 15 Jan 2019 15:33:37 -0000 Received: from unknown (HELO mail-oi1-f182.google.com) (209.85.167.182) by pb1.pair.com with SMTP; 15 Jan 2019 15:33:37 -0000 Received: by mail-oi1-f182.google.com with SMTP id y23so1928224oia.4 for ; Tue, 15 Jan 2019 04:09:30 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=OcQavzwsxRsTHKZiK5JuknkMoXlp3Z53G6D5xfCtcb8=; b=aN14BGBr3gEHRf8i7RIyM78tXXfieVzP89ys6N3ox9YojSIvnQVaXirLiS4AA3e4ur Xqyfoq6NPVIOm9cp3qiSZvCScRPAPQGXyV39MiBIBFe3CaI4f6L0TNLXyDAOcjmBn5cN 4EzxhZBH8TuoYZEbbuhlj+OqzixTbN7mWgJNIsgSKEdeRsWrqBdBFCJzU/O8OV1AgP+i PjNgM7pObyH6FPljPS1nR9cB2IlR0iypB9RLF1oPKfpHUqVo40T+USjT/9LOuNZwAzDo g+LSlgoaKx33bjP19mS7qZCrhl6/60qbWiVsgiDoeli0WRQ46lTPmRnXWGtUE/dJXziv 3RQg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=OcQavzwsxRsTHKZiK5JuknkMoXlp3Z53G6D5xfCtcb8=; b=WQ5dQnVwED/YJLPSs+Tcpq2V97SfW9j0W0/rezWwCrFbFOcQdvAHfmgprIsUax7LDc zZWbyRDyKQWziyJLMCjBfdotmQc3iLLOIT9LZidMfdOO+JWDwKGsN5WKVVSPE9uRuW/u 7xoNIsQSDk1J/zkVk2+CLy4hIYn2qQLqD5BzkDlKJ6A1B8v2gSqcEjtn7ybOVfFRMhmO phO7KH2+gDhJQqVaxNZuWevq2Qn+trBb1kR7st1ciKaFVVT12Ni0CMxiXtcKIS1aEtzu 1A2gogdemdbH6A3NMgVTxuJtByb2z9yseXpIFRiNH2m/kk1dObEugUUsX0+XY+Ko3O25 mBNg== X-Gm-Message-State: AJcUukfoF9EZ29HtAjz1yhHQZEWES29mc88MYUWmtg2INWY3dqXWdaAC OAfWOHt7pZTX40ZWgtdiUFGEv+nyDQgpKSwYzdc= X-Google-Smtp-Source: ALg8bN75vHDUAxs0asofKBCsMYfX6Ea3pgPD0SGsiXYHRiHM9LWTWejV8iYYXGeD4Ibslvv/96sO+bR+AG/hhmNpxZ4= X-Received: by 2002:aca:3a83:: with SMTP id h125mr1725218oia.308.1547554169251; Tue, 15 Jan 2019 04:09:29 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Tue, 15 Jan 2019 13:09:17 +0100 Message-ID: To: Nikita Popov Cc: PHP internals Content-Type: multipart/alternative; boundary="000000000000876b0b057f7e08ed" Subject: Re: [PHP-DEV] [RFC] Reflection for references From: nicolas.grekas+php@gmail.com (Nicolas Grekas) --000000000000876b0b057f7e08ed Content-Type: text/plain; charset="UTF-8" About using "int" as return type for getId(): > * Can the `getId()` return type be restricted to either `int` or > > `string`? Why is it a union type right now? Technical limitation? > > To allow changes in the future. The real return value here is an int, but > the size increase due to hashing makes it a string. If we find a way to > avoid that (or decided that we don't care about leaking addresses), we > could change this to a (faster) int-based API. > spl_object_hash() uses a XOR to hide internal addresses - so they're already "leaking". we also added spl_object_id() which proved much better in term of memory usage - not only CPU. Mixing both arguments/approaches, what about returning a XORed int? Are we OK with that? It'd be a welcome storage/CPU optimization from my pov. --000000000000876b0b057f7e08ed--