Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:101412 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 21121 invoked from network); 24 Dec 2017 16:30:29 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Dec 2017 16:30:29 -0000 Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=nikita.ppv@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.52 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 209.85.214.52 mail-it0-f52.google.com Received: from [209.85.214.52] ([209.85.214.52:46227] helo=mail-it0-f52.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A9/31-21991-226DF3A5 for ; Sun, 24 Dec 2017 11:30:26 -0500 Received: by mail-it0-f52.google.com with SMTP id t1so18897234ite.5 for ; Sun, 24 Dec 2017 08:30:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=QwMEGcg6ipbgsz862mJGG4oxY6eZA/pRilwpz4oztug=; b=OBG55lr8+q5mPTd6eG/lUO0iB0+mXi2dD3mzAI5xcEJrYcQRRB9memPQ2IgfV1lxga b4sQmOrrN3FLstyoHwnFjZknW9mF8kl4IouyIcbMXOr+2bgEBUjzGBVfX1jmKlYA4KQH VhALudYgQC4IU7Fgga99EEgi8A86GkQxMsFyDztXJRXmDWiC7pX8VdaIRbT0C0MRaBuJ OK/a425CqnVwNXhsN3h1MFBOTDj0fXEE2ut13GZaj+7kNF0jFGwI1hVF6d72U/Nix71n JWxWE1H0egekyLWrTb42E912+ElAH/acIRL3cBmNw7qf0dnBuK4x6Z07IlTrQiUcOEAv hfFQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=QwMEGcg6ipbgsz862mJGG4oxY6eZA/pRilwpz4oztug=; b=mNdAyhW0trmQQgZsZGSbPndKxymSdcDL+AAd7FECh9+p/F/xOufZuVnHnVM9Hod98v lk+TT5NHr0wRW9xVOtBIXixRSKkXmyFtC+S6UjMn853ANQXILKJumgJWfPJap4iNlgtC LiXmyDv3hq2BjSjAjFEpPofTb+B1nQxytf2zuCK1SMVGTSOk2vu+44AsS69C7fGPFuhP H5457LwiJK586XF860UlGn43J4XjLRi67t4gJaTJx4hJ2ZFWtDCUNbCoO0yF1KdW/Jcu n0z9evk1KKyTT9ODVTQS0iGx/S1QushywEfSHmu4BWNLZJb3IyF01qJ+gbLBOrL/tawh GJ7w== X-Gm-Message-State: AKGB3mLDPfJwStWH3OfHHjlISJkVMCTlHKRihzodhE12Gr4YgFLEBEo3 SssjiU6wFIXC54bZ6I7jC6NEIWUSKqimoRXaGVs= X-Google-Smtp-Source: ACJfBotNsRJXWPEbnpcaBFqGJHfd31NeeYSGpGY9dniZE34da+Wqs31gpLCfYuwGuh55z77JpMBnnYqP1D58uJxFT/E= X-Received: by 10.36.81.82 with SMTP id s79mr26887394ita.144.1514133022922; Sun, 24 Dec 2017 08:30:22 -0800 (PST) MIME-Version: 1.0 Received: by 10.107.53.216 with HTTP; Sun, 24 Dec 2017 08:30:22 -0800 (PST) In-Reply-To: <72392123-d37b-26df-6886-218f48205f8a@fleshgrinder.com> References: <72392123-d37b-26df-6886-218f48205f8a@fleshgrinder.com> Date: Sun, 24 Dec 2017 17:30:22 +0100 Message-ID: To: PHP internals Content-Type: multipart/alternative; boundary="001a113faf50f95d2605611890da" Subject: Re: [PHP-DEV] [RFC] [DISCUSSION] Scalar Pseudo-type From: nikita.ppv@gmail.com (Nikita Popov) --001a113faf50f95d2605611890da Content-Type: text/plain; charset="UTF-8" On Sun, Dec 24, 2017 at 3:34 PM, Fleshgrinder wrote: > Hi Internals! > > I prepared a PR to add the `scalar` pseudo-type to PHP after the > discussions around adding a `mixed` pseudo-type. I strongly believe that > it makes sense to provide the most common primitive union types with > handy aliases even if we are going to add union types in the future to PHP. > > https://github.com/php/php-src/pull/2987 > > I added support for parameter type covariance and return type > contravariance to make it as useful in daily development as possible. > > I will provide the RFC write-up asap at: > > https://wiki.php.net/rfc/scalar-pseudo-type > I think this RFC could benefit from displaying some use-cases for this type annotation. I can't recall any recent instance where I would have found this specific type combination useful, though I'm sure there are good examples. I also wonder whether in weak typing mode, scalar should also accept __toString objects (and cast them to string), similarly to how a bool|int|float|string union would behave. Nikita --001a113faf50f95d2605611890da--