Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:93769 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 78184 invoked from network); 4 Jun 2016 16:06:28 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Jun 2016 16:06:28 -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.82 cause and error) X-PHP-List-Original-Sender: php@fleshgrinder.com X-Host-Fingerprint: 77.244.243.82 mx101.easyname.com Received: from [77.244.243.82] ([77.244.243.82:40160] helo=mx205.easyname.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 16/96-25194-28CF2575 for ; Sat, 04 Jun 2016 12:06:27 -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 1b9E5f-0004PL-6q; Sat, 04 Jun 2016 16:06:23 +0000 Reply-To: internals@lists.php.net References: To: Dan Ackroyd , "internals@lists.php.net" Message-ID: Date: Sat, 4 Jun 2016 18:05:58 +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="N8LFmQgHVhJLjhGoXN6pI4lQUtwWw7Xmn" X-ACL-Warn: X-DNSBL-BARRACUDACENTRAL Subject: Re: [PHP-DEV] [RFC DISCUSSION] typeof From: php@fleshgrinder.com (Fleshgrinder) --N8LFmQgHVhJLjhGoXN6pI4lQUtwWw7Xmn Content-Type: multipart/mixed; boundary="GNjbR8vhxX8c2H2fa8D1M42VIKLwepCrd" From: Fleshgrinder Reply-To: internals@lists.php.net To: Dan Ackroyd , "internals@lists.php.net" Message-ID: Subject: Re: [PHP-DEV] [RFC DISCUSSION] typeof References: In-Reply-To: --GNjbR8vhxX8c2H2fa8D1M42VIKLwepCrd Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 6/4/2016 4:34 PM, Dan Ackroyd wrote: > Hello FG, >=20 > Having a standard way to get the type of a variable, that matches the > name of how it appears in PHP is a good idea. >=20 > The 'extended' parameter is not such a good idea, for various reasons > but mainly because it's simpler for people to call is_callable() as > well as typeof, rather than having to interpret the extended string to > tell if a string represents a callable. >=20 > The same is true for floats; it is easier for people to call > is_infinite or is_nan rather than searching inside a string for > 'infinite' or 'invalid'. >=20 > cheers > Dan >=20 Hi Dan, many thanks for your feedback. This is definitely NOT the purpose of the extended mode, and I tried to emphasize this in the RFC. I also think it would be very bad to introduce anything that would compete with any of the existing is_* functions. It is also the reason why the strings are very verbose and human readable: they are meant for debug and error messages. // complicated code ... // error branch {{{ $type =3D typeof($v, true); throw new Ex('Expected Foo but got ' . $type); // }}} // complicated code ... This matches the main usage -- according to my research -- of the existing gettype() function in userland software. :) --=20 Richard "Fleshgrinder" Fussenegger --GNjbR8vhxX8c2H2fa8D1M42VIKLwepCrd-- --N8LFmQgHVhJLjhGoXN6pI4lQUtwWw7Xmn 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 iQIcBAEBCAAGBQJXUvxtAAoJEOKkKcqFPVVrCCQP/jLJ8f4zzWRxCV1iOIf1PB4+ 3PNWwzIGPJB4pWPagmqWXQo6HPtwh4HbVZ/3V6PtPhleAOheuSLqBA5VBxbQMm/L NHiuzyiY8q2MFkxzBdPTDBeiH/RCq1mI6jztFYNl63b5dyGl17xXC0iHbpQU2oSz DeBiA87jTA9q5WcjM7YgQCRbDgx/KVdFXMn3b/cADbH8FPAbLgMd8juZf4aIXG70 17ZNpBhy40/ct2p6cEFeBOG/KgbB3cEKEyiOxu3kqjERUBGdPdY2gwpOvBy3eaX1 5rVz4pIi5UcP10ysyVqw2xyQ+Rd12QGmfUD6GzcxsjijH+BgJxTaOZwrL/1dnpRm yRybc1hbVex9fNfIZll/NNBeCVfrexglrcuDbk11dCBSuAJjAyASAhzKqW6RRvvt TVOvb61P5XQwHn9FcTJN6R7Yb0m3LQ+Un7UD18jEhOXA4MsM0AqMU4gHiFC+TyI1 a/aUjFJjfwcdjndwJ+eXfzr3wM1fScKKNUGMyx8A/vp6by8HAmgTDYwc59loqIGe ChIDO+SVh7QzSOROl43aIcqDQrL4MqDUjWDuan7ruBpylwQJt/3UbZqw/5Z4AWpP FbceXrKX7Id5n3q/98BEgLcm1jVcv6MEuobxIgGStqYgvDb06NIWiLRHMLgYz0/y H2l8vbtm8z64YKM+FRz2 =jRDV -----END PGP SIGNATURE----- --N8LFmQgHVhJLjhGoXN6pI4lQUtwWw7Xmn--