Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:105208 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 3806 invoked from network); 10 Apr 2019 17:43:22 -0000 Received: from unknown (HELO mail-lf1-f52.google.com) (209.85.167.52) by pb1.pair.com with SMTP; 10 Apr 2019 17:43:22 -0000 Received: by mail-lf1-f52.google.com with SMTP id g7so2013337lfh.10 for ; Wed, 10 Apr 2019 07:40:31 -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=WrV7XKfwgEgPXGLePmFK9OEL0OhmWIZmlPfgABhwYYA=; b=s9Jx9ysfV7nnyBDmRSUzurJD8TJeWc2UQRJ3GS0ARJq2gVkstea3BzItc+gg4bVXMe /nhdrIgmBtaov6Cc+SFf/LvzBzrskRD8ItQ5EE+ZSUmwTBm07KljZPo6bKgSRnLOJIt+ PY4/zHriK4T2zazf09N5lAYn8BEH3AOkH/Giy8wkCwErA66pUBCjD5gB00cuyl6Ho01z +KiFCnHYnn5BASQwg/9NMerYU49Xw9IxlijAsFYctOZ3jC1iNzLuZRWHCegwiDDZtSWZ tIYR7HBovr7ZowUbczyqUgofk4qA+7TtgBj7uIShZlyqEeY9jRJj+IXLua1WW9PS/7Qf CPQQ== 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=WrV7XKfwgEgPXGLePmFK9OEL0OhmWIZmlPfgABhwYYA=; b=jcRueYjEwiYhaZOObe6lqUgYZqXxUxEgqfvU7FAoZwzJw+W41i4Aaoegq64FAusuYY FeEsWYqf65VEWAMh9TP3RTlprAnyU465iJdtmYoaoNlikGiN//fQkL/dQSkhD3Bq/ikE TY581rGvPBc4R4KQHVXUloS3syLPmuFXMKFGJj88AS1Zh4pVk5K1UDc2N1q4S9X5/EeO nGRFB1nkpjNlN7P4tz5iztfDsXqNhDe3C5wpIaTbYIORV2kB5H0p+AAKS1eTI7SbT7R1 DTEiUrq2Ezk6uKu7926aSRBj1gxnQv2M1YfqN1rdd4VvWYmu94GpOLnPb1EY9nCt5dFM vGJQ== X-Gm-Message-State: APjAAAXDS7vCcVhnbj9fDgZvqGRGKk7VvsW155VyV9Cu4Yjeye0bkwvI ERyCH4Pk1neBapnEioi+iVuBOIDzBTqk7bXvQw== X-Google-Smtp-Source: APXvYqxKf1as3yVdOq3BSyvE2SI2Dpd3jGbLkBng3wp8EoLq6eAv0WMWTrEVbe5WUe97l3iHKJDLKsWf3nY34M8gvQg= X-Received: by 2002:ac2:4119:: with SMTP id b25mr5863348lfi.72.1554907230983; Wed, 10 Apr 2019 07:40:30 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: Date: Wed, 10 Apr 2019 16:40:18 +0200 Message-ID: To: Nikita Popov Cc: PHP internals , David Rodrigues , Benjamin Morel Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] [RFC] Nullable Casting From: guilliam.xavier@gmail.com (Guilliam Xavier) On Wed, Apr 10, 2019 at 12:52 PM Nikita Popov wrote: > > 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. The syntax mirrors nullable type declarations, but the thing is implicit and explicit conversions don't always behave the same today: ```php