Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:83533 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 34084 invoked from network); 23 Feb 2015 02:32:42 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Feb 2015 02:32:42 -0000 Authentication-Results: pb1.pair.com header.from=smalyshev@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=smalyshev@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.220.46 as permitted sender) X-PHP-List-Original-Sender: smalyshev@gmail.com X-Host-Fingerprint: 209.85.220.46 mail-pa0-f46.google.com Received: from [209.85.220.46] ([209.85.220.46:39590] helo=mail-pa0-f46.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 08/37-33016-A419AE45 for ; Sun, 22 Feb 2015 21:32:42 -0500 Received: by pablf10 with SMTP id lf10so23802970pab.6 for ; Sun, 22 Feb 2015 18:32:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=PC7fvXoAaCDKp/YpJiiQWf6EvpT1fZt4vV1IO4QgP5Y=; b=dfmlLtvB65iZ6nA4DZhNcGDDcw0WvUjNi8yRBOZ7BFclIHEUn3nFs8+zDhfWP23rlt jVNIQH+OUgFTlG6X5rxJPlt3XpFKfzWGL5g0lJJd5r8ce+NaLDYJHmeWQO+QfMQiGuPv aksx1oTkvHLv0MJZ9cp3eK8Qe1xxLOgn6HrbbLZM7yzaNQdhCSrSYpVaZEfzkD73kiXj F4ZSaNZO9Q/CTCAKso8fFu+7XoNfCxs51DnuDLlO6nJAdTDrBd6/C2r+ILSCrzDJGoTl 26wJRpCfwS8qf5nDRU61LbuupdW7xP6qq2OVgXLYN3z/TZLBDiRs4l+p4HWNk82MuD85 PBGw== X-Received: by 10.67.5.226 with SMTP id cp2mr15673882pad.122.1424658759509; Sun, 22 Feb 2015 18:32:39 -0800 (PST) Received: from [192.168.2.145] (108-66-6-48.lightspeed.sntcca.sbcglobal.net. [108.66.6.48]) by mx.google.com with ESMTPSA id iy2sm2697762pbb.22.2015.02.22.18.32.37 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 22 Feb 2015 18:32:37 -0800 (PST) Message-ID: <54EA9145.80304@gmail.com> Date: Sun, 22 Feb 2015 18:32:37 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:31.0) Gecko/20100101 Thunderbird/31.4.0 MIME-Version: 1.0 To: Jefferson Gonzalez , Anthony Ferrara CC: Zeev Suraski , PHP internals References: <2e4694f9805ee81ea0b2c79eab06c2d6@mail.gmail.com> <54EA5EDA.8010605@gmail.com> <54EA6A99.5010609@gmail.com> <54EA7F15.9030606@gmail.com> <54EA891B.6030405@gmail.com> In-Reply-To: <54EA891B.6030405@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] JIT (was RE: [PHP-DEV] Coercive Scalar Type Hints RFC) From: smalyshev@gmail.com (Stanislav Malyshev) Hi! > How is coercive much smarter? Basically what coercive would do is It can accept 2.0 but not 2.5. Explicit cast is a sledgehammer - it would convert both to 2. > How casting (int) could be such dangerous thing? Lets take for example > this code: > > echo (int) "whats cooking!"; > echo intval("whats cooking"); > > Both statements print 0, so how is casting unsafe??? Casting by itself is not dangerous. What is dangerous is using casting to work around type system - since in this case it could hide an error (such as passing string "whats cooking!" to function requiring integer). Of course, you can say such errors are of no importance to you - in which case you should never use typed parameters at all and you'll be fine :) (mostly) -- Stas Malyshev smalyshev@gmail.com