Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:105202 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 42962 invoked from network); 10 Apr 2019 13:55:32 -0000 Received: from unknown (HELO mail-io1-f41.google.com) (209.85.166.41) by pb1.pair.com with SMTP; 10 Apr 2019 13:55:32 -0000 Received: by mail-io1-f41.google.com with SMTP id v4so1693513ioj.5 for ; Wed, 10 Apr 2019 03:52:39 -0700 (PDT) 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=sX6JGIF5Xz5afAfOVZKlUqfvMfAs3EHTVx4brOfCk6k=; b=JWk52rpC3dyjN2hMKTZI+VTo+Eld/QOQI6N51+pkgH9dOhfBT7cIMhh8ezbzFcDu6X dIdgUhRnaRnCtsvdAWOr4fqlZJEOvrwtg+PBBxDjeBehyDIVb2qR1ALVzZ6poRf3Mfn6 s1u0rWMxDuJRjnB/9nZOl7P+xW3xmF35YkaAAmnLS4M39BkK3v/YIZwfpX5lR746T2DK iDwhvsZdS+ALIWTfguvh2m31W3TzjaAOEGyBSuCW7qlGTDwChkwuPAKT2jxtOsK59tDD T9yKjUNznVgNtYx6CiMgluKuDowZs7Y6ZSUpvydXA6d/W5r/jEP/po33o86sUjsJ0rfA yvpg== 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=sX6JGIF5Xz5afAfOVZKlUqfvMfAs3EHTVx4brOfCk6k=; b=RLoYhmKpp9oCE5n7tElMVaE9qECu1l7KJRkTZOfaLptqOT1VkSvRt5/lK48+nAnvet I+PL5kNzJLKjFy9eAl17SJ6LvgwqnzJD2iIkUPmBKZL4SglPflEXg2PivuVuGu29iCQ3 ZM7vcQiCVHEtt0lanBZr0j8OL2Jp8FpwiC5lFqiOqzQzY9j1C5oUkpXp6ZBWAZIbgy15 eoA7MKXVx+LDansirAWbvv3eGO/jiig4XzY+Vy9Sspk6Wu/O5dn8cLenCJ0wCIpWiKAN T3ym41owql7ObJlrv0L1dDn9Y8ucAoPbVK9a8tmvVz7TZjvvwv0XJoBcSandDHrdD2t+ cQZw== X-Gm-Message-State: APjAAAUNG+qnyYQAl/EkT/09Ay6HKggJGYiWv3Ds5tnvXeIU5BFCrmnf 0jJ8eYxQ+SmE/OOYa05SBjt4o1/Qxqf+rtyETJ8= X-Google-Smtp-Source: APXvYqzTRfqCcNfT9x4pdi6d7+8I0JDGsHIqpP8eWUz5tRfzWxgGXLkUH+2UInn0jg7gCEuaEc84GG4i5MFaNxDVx2k= X-Received: by 2002:a5d:9a8d:: with SMTP id c13mr10305747iom.195.1554893558793; Wed, 10 Apr 2019 03:52:38 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Wed, 10 Apr 2019 12:52:22 +0200 Message-ID: To: Guilliam Xavier Cc: PHP internals , David Rodrigues Content-Type: multipart/alternative; boundary="0000000000003c4beb05862ade6e" Subject: Re: [PHP-DEV] [RFC] Nullable Casting From: nikita.ppv@gmail.com (Nikita Popov) --0000000000003c4beb05862ade6e Content-Type: text/plain; charset="UTF-8" On Sat, Apr 6, 2019 at 9:53 AM Guilliam Xavier wrote: > Hello internals, > > David and I would like to open the discussion on our joint RFC: > > https://wiki.php.net/rfc/nullable-casting > > Mainly, it would enable to use e.g. `(?int)$x` besides `(int)$x`. > > We are looking forward to your feedback and, if possible, help to fill > in the "RFC Impact" subsections (hopefully "None" to all) as well as a > review of the proposed implementation: > > https://github.com/php/php-src/pull/3764 I'm a bit concerned that there are two possible semantics for what (?int) does: 1. What I would intuitively expect: A fallible integer cast. I.e. try to cast to integer and if not possible return null. So (?int) "foobar" becomes null rather than 0. 2. What this RFC proposes: A normal integer cast that leaves null alone. Both behaviors make sense to me generally ... and if there are two ways to interpret a piece of syntax, I'd say the syntax is not explicit enough. Nikita --0000000000003c4beb05862ade6e--