Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:58621 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 69292 invoked from network); 5 Mar 2012 20:22:21 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 5 Mar 2012 20:22:21 -0000 Authentication-Results: pb1.pair.com smtp.mail=linepogl@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=linepogl@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.161.170 as permitted sender) X-PHP-List-Original-Sender: linepogl@gmail.com X-Host-Fingerprint: 209.85.161.170 mail-gx0-f170.google.com Received: from [209.85.161.170] ([209.85.161.170:34344] helo=mail-gx0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 08/2E-35539-C70255F4 for ; Mon, 05 Mar 2012 15:22:21 -0500 Received: by ggmb2 with SMTP id b2so1460943ggm.29 for ; Mon, 05 Mar 2012 12:22:17 -0800 (PST) Received-SPF: pass (google.com: domain of linepogl@gmail.com designates 10.236.177.6 as permitted sender) client-ip=10.236.177.6; Authentication-Results: mr.google.com; spf=pass (google.com: domain of linepogl@gmail.com designates 10.236.177.6 as permitted sender) smtp.mail=linepogl@gmail.com; dkim=pass header.i=linepogl@gmail.com Received: from mr.google.com ([10.236.177.6]) by 10.236.177.6 with SMTP id c6mr29285335yhm.42.1330978937408 (num_hops = 1); Mon, 05 Mar 2012 12:22:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=SrFFr1wgRT7izsnN6OSS5gBJlGQxAykyMh3M3vgeNko=; b=zJrUnc0LS26xloa1K3dU3tHe2GlJKr7t0DIe/PO8nMAMuchHVvF9+qSE4+4nSURqgB f0dtD4AMjA6OQRnXyt7CewcvKalmTxTCMSnwnY2AdxQGMvLKY6WQV+JqPI7GY8T8F/X5 ZxyS2+R7sbtWVoYre0IqEUykgFZXgIcu4tVkMOa52Y3ixIaGi0K4tTqZSKc1pQe+xE/J ANIsyEGM84iEuLkseJ1b6nOaZJxETepBEs0TlaO5ZE435SSo9DnPOvSDkMTAnnLR1WOj pi5n2BBLdEG6em2ffkBEnmQn6Uv5nn943J6Xw2R/Pm3feejBJduqnSvK+UV5fYVA+Nfg tB9Q== Received: by 10.236.177.6 with SMTP id c6mr23098688yhm.42.1330978937321; Mon, 05 Mar 2012 12:22:17 -0800 (PST) MIME-Version: 1.0 Received: by 10.146.144.35 with HTTP; Mon, 5 Mar 2012 12:21:57 -0800 (PST) In-Reply-To: References: Date: Mon, 5 Mar 2012 21:21:57 +0100 Message-ID: To: Daniel Macedo Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary=20cf30563901c33a3d04ba84ae86 Subject: Re: [PHP-DEV] [POC Patch] Scalar Type Hinting/Casting - Proof Of Concept From: linepogl@gmail.com (Lazare Inepologlou) --20cf30563901c33a3d04ba84ae86 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hi Daniel, No, it is not inspired from the short ternary operator. It's a rather common conversion. C# has a similar notion of nullable types (with totally different mechanics however). By the way, in this particular area PHP's type system is more sound than that of C#, because null is not just a special value of any type but it is a value of a separate null type. Kudos to the original designers for this choice. Your proposal for (int unset) is not very far away from what I propose. In PHPDoc, and in many IDEs, there are often mixed types like these: int|string int|null string|bool|null bool|null DateTime|null ... Of all different combinations, the ones between a type and null are very usual. So, I propose "int?" as a shortcut for "int|null". In that sense, it is totally equivalent to "int unset" that you say. Personally, I find "unset" not proper for this case, because it is not going to unset anything that is not already null. > BTW: Order would equal what is type casted OR simply accepted! Do you have any examples where this could be useful? Lazare INEPOLOGLOU Ing=C3=A9nieur Logiciel 2012/3/5 Daniel Macedo > > This could be usefull for other instances as (string null) or (bool > > null) as well... Your thoughts? > > Typo! The examples should read (string unset) and (bool unset) > > BTW: Order would equal what is type casted OR simply accepted! > > ~ Daniel Macedo > --20cf30563901c33a3d04ba84ae86--