Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:83020 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 24777 invoked from network); 18 Feb 2015 05:51:28 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 18 Feb 2015 05:51:28 -0000 Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 209.85.213.47 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 209.85.213.47 mail-yh0-f47.google.com Received: from [209.85.213.47] ([209.85.213.47:40226] helo=mail-yh0-f47.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 65/50-18888-E5824E45 for ; Wed, 18 Feb 2015 00:51:27 -0500 Received: by yhot59 with SMTP id t59so1566259yho.7 for ; Tue, 17 Feb 2015 21:51:23 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=h91EK43AdCHLMNtIFvytzwULY4tRhbZnGf8aswlWikY=; b=RyuS7E14RMzYns/AR3QdWn7ADlVaFnh+LE6RFwPQ48vBdh38XtrbAYQ6zBzLS/shj3 4Tw9hOi5LGNc4pCcE7CcqpXdFzazezyCyuquLRhF69aGWmg1XeFxlxqodbG3cmEfvXnN xcOiuvWgH88xkucGxbDV10IvO1fzbqb85pmbwJnja1nWlvTmHX1hzJ9jq1drQtEFTan0 QdV5iCbeuYVorRpPwEkonWZAG0mJN7BZHU+NKyQcm5meJXxKgVzMUJF6huZKxyYrtHAf +N6BYTLIxnicV0pR/fsH6tivNoEjqA4OkIPT+r//tYOYd9GB31x2F4bNgbwpmDOc5LhZ H0Ag== X-Gm-Message-State: ALoCoQkCEIA102IeW/4UTzFjm1B2RJxQ6DwU7UxomU0L1zeUjo1hQ0OjZviQauz2GXZd0ECTepr8pdXAYuwvarcq6brwBJnz0/1zEph3n99E7AZKVh7eKUYRKFh0v+HRHvafQPLOZyG9DjQN9PDqN8tTxcXyNrL4rg== MIME-Version: 1.0 X-Received: by 10.53.11.76 with SMTP id eg12mr2298342vdd.68.1424238683518; Tue, 17 Feb 2015 21:51:23 -0800 (PST) Received: by 10.52.74.73 with HTTP; Tue, 17 Feb 2015 21:51:23 -0800 (PST) In-Reply-To: References: <54E3E27B.2010903@lerdorf.com> Date: Wed, 18 Feb 2015 09:51:23 +0400 Message-ID: To: Nikita Popov Cc: Rasmus Lerdorf , Sara Golemon , PHP internals Content-Type: multipart/alternative; boundary=001a1133f056ce96e7050f5668e7 Subject: Re: [PHP-DEV] Scalar Type Hints v0.4 From: dmitry@zend.com (Dmitry Stogov) --001a1133f056ce96e7050f5668e7 Content-Type: text/plain; charset=UTF-8 On Wed, Feb 18, 2015 at 4:05 AM, Nikita Popov wrote: > On Wed, Feb 18, 2015 at 1:53 AM, Rasmus Lerdorf > wrote: > > > On 02/17/2015 04:35 PM, Nikita Popov wrote: > > > I don't buy into Rasmus arguments about internal functions. They > concern > > > one particular edge case (int->float coercion) and I doubt they have > much > > > relevance if applied to codebases with pervasive use of typehints > (where > > > you can be reasonably sure of the types of your variables). Even if, > for > > > the sake of argument, we acknowledge the concern as valid we should be > > > discussing that particular case (int->float coercion) rather than > > dropping > > > the strict typing for internal functions altogether. > > > > int->float is actually secondary to "123"->int. And while they may be > > edge-cases there are enough of them that we would be pushing people > > towards casting by default which should be a last-resort thing, not the > > first thing you do. > > > > The inability to implicitly cast "123" to int is pretty much the KEY > distinction between weak and strict scalar typehints (those pesky > value-dependent type checks). If the strict typing mode doesn't offer this, > what's the point at all? > > This is exactly what I fear will happen with an arginfo based approach. If > even fundamental aspects like the "123" vs 123 (or true vs 1) distinction > are suppressed for internal functions, this isn't a strict typing mode, > it's just a weak typing mode with slightly different rules. > > The difference between true and 1 is even more strict than rules of statically typed languages. Could you write a short list, where the strict types are really useful. In my opinion it's only program verification, but for this case we may enable strict typing by a tool and not in the language definition (we may provide callback in the core). Thanks. Dmitry. > Nikita > --001a1133f056ce96e7050f5668e7--