Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:93771 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 82294 invoked from network); 4 Jun 2016 16:42:21 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Jun 2016 16:42:21 -0000 Authentication-Results: pb1.pair.com smtp.mail=php@fleshgrinder.com; spf=permerror; sender-id=unknown Authentication-Results: pb1.pair.com header.from=php@fleshgrinder.com; sender-id=unknown Received-SPF: error (pb1.pair.com: domain fleshgrinder.com from 77.244.243.84 cause and error) X-PHP-List-Original-Sender: php@fleshgrinder.com X-Host-Fingerprint: 77.244.243.84 mx103.easyname.com Received: from [77.244.243.84] ([77.244.243.84:58942] helo=mx202.easyname.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 25/57-25194-BE403575 for ; Sat, 04 Jun 2016 12:42:20 -0400 Received: from cable-81-173-133-15.netcologne.de ([81.173.133.15] helo=[192.168.178.20]) by mx.easyname.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1b9EeP-0003XX-63; Sat, 04 Jun 2016 16:42:17 +0000 Reply-To: internals@lists.php.net References: To: Marco Pivetta , PHP Internals List Cc: Dan Ackroyd Message-ID: Date: Sat, 4 Jun 2016 18:41:56 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="R226q22MbeG3gRi6WhU11wg0xoHNApHbC" X-ACL-Warn: X-DNSBL-BARRACUDACENTRAL Subject: Re: [PHP-DEV] [RFC DISCUSSION] typeof From: php@fleshgrinder.com (Fleshgrinder) --R226q22MbeG3gRi6WhU11wg0xoHNApHbC Content-Type: multipart/mixed; boundary="x0hsoVgsmHwr7GFcv9HW5bagPI1OvEMge" From: Fleshgrinder Reply-To: internals@lists.php.net To: Marco Pivetta , PHP Internals List Cc: Dan Ackroyd Message-ID: Subject: Re: [PHP-DEV] [RFC DISCUSSION] typeof References: In-Reply-To: --x0hsoVgsmHwr7GFcv9HW5bagPI1OvEMge Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 6/4/2016 6:17 PM, Marco Pivetta wrote: > It would be beneficial to not reduce this to stringly-typed programmer > (again), as Dan mentioned. >=20 > Returning something like a ReflectionType instance (which then implemen= ts > __toString) would be much simpler, efficient and easy to use. >=20 > Marco Pivetta >=20 Hey Marco, not sure if I like that approach for a procedural function. If we would want that than it would be better to implement it as a named constructor of the actual class. class ReflectionType { public static function from(mixed $var): ReflectionType; } But anyways, it would result in changing the purpose of that class: > The ReflectionType class reports information about a function's > return type. I'd argue that we would need a completely new reflection class to handle this use case, e.g. ReflectionVariable. However, I cannot see that this is actually required while looking at the usage patterns of the existing gettype() function. The goal here is to continue supporting the existing mode of operation and its usage in userland while updating it to reflect the current state of the type system. Additionally, pretty much nobody uses it to determine the type of a variable but merely to include the resulting string in debug/error messages. The reflection class approach would mean that even more reflection code ends up in production code, another thing I consider questionable. --=20 Richard "Fleshgrinder" Fussenegger --x0hsoVgsmHwr7GFcv9HW5bagPI1OvEMge-- --R226q22MbeG3gRi6WhU11wg0xoHNApHbC Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJXUwTXAAoJEOKkKcqFPVVr0PwP/1/Ak5TkyrUdPM4nSOVH1cNJ KM/3YFpa+RF9HUHQE58ZDBZfQI3PpzfgtTodXJ2gGwB5MukwlMpsS/yBEQsvcelS dBceILREoyQioCjEDHgUZUxbJSIjuDDsrlWBE3hk1Ti4LeY1Bnc9+bUKtiKy4E+A 5e52kXFn2z82VBiEFt4SnoSUXSVWGWytrSNbVlQFVxUoPmv31J2UkLNXdw2jkva2 odG993SWrr6KdEaVeAVnn5YwJ46fmsHdFP8jy9Wjhfdiv2SbLpzOUkVMTiB2HqXn q6CDZ/B8WNq1ib6kyDeJ1cvb7gYT5arIYqA2iPJ4dzKkKbGeeRv64cvLEvizPwb0 jTeQziQJ0/xCkoqadiFTIe+SnsTQVp/CuWsj4ziZxivdv8ErlJr9O+fcYvF9Mvfs /6tNXHYGtUAV26230UnpedNtASxEy3tdQiTia99mJBPT3JmRzbfSQDFEiJ857ZH3 InoKtl4IO/X1KX6ruwWmWmc1HLCX5juk+2aM/j/wCEvfYfSulxpqN8BaOJ5h8Huv fQns1pqaLULzY5YvaEus+HhPLQKqWpOp84kZt7x4VfTeI+aFRfcQ6gSiISm1Qjf9 CwGjmzE338hd+//kOw3tSMcINz+Fcao7zTVB0bobmayrn08qDNjmPzPLADkbj1mz RTLvxzmIFaSD9Y8rA5R6 =qYFG -----END PGP SIGNATURE----- --R226q22MbeG3gRi6WhU11wg0xoHNApHbC--