Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:81809 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 2900 invoked from network); 4 Feb 2015 11:15:20 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 4 Feb 2015 11:15:20 -0000 Authentication-Results: pb1.pair.com header.from=narf@devilix.net; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=narf@devilix.net; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain devilix.net designates 209.85.218.48 as permitted sender) X-PHP-List-Original-Sender: narf@devilix.net X-Host-Fingerprint: 209.85.218.48 mail-oi0-f48.google.com Received: from [209.85.218.48] ([209.85.218.48:33899] helo=mail-oi0-f48.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B1/C9-55046-74FF1D45 for ; Wed, 04 Feb 2015 06:15:20 -0500 Received: by mail-oi0-f48.google.com with SMTP id v63so726508oia.7 for ; Wed, 04 Feb 2015 03:15:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=devilix.net; s=google; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type:content-transfer-encoding; bh=ka+oco2/DXHCZULRn0/rACJOgjCCSBwsAmWNc5/dPDY=; b=id/vPMQ8IzMKHtYMRX0G05Vh4v4KyoR5sYNLiuLhse1gRRIUAcqT4irGqzdZXOnFaO nDxxyUEToENCQhAODVKiJzSPb4k9WsX4ae+JMqN2c8rzB6GLO/V+a6hRxIGoSmfB81up rUo9tVh7RRlRoKB2PBvtOc0Ucyas2xrfuJ3vw= 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 :content-transfer-encoding; bh=ka+oco2/DXHCZULRn0/rACJOgjCCSBwsAmWNc5/dPDY=; b=Vf7V9WJgbCbOJ4HiKnmawpVitjdnX+Dga/B5rn+kYZ2y8FdNs5tjRd6UykPJnCFPeE tAI6BL9HotR8urOqIyc9RgHyh1yWH11LmkmqQFaKRvuCYCKi2PrEOjspyo+QYsd3Pd1V LOTkCtFz43vPbanpZdOCopwjetDIeSnAFuY8334W5j2LTTA5aduu4G6Sf6Q0CpURJudZ iLlbK2p9zgHVcdPtU9yODyWTnX9TGjChK09xAGIZcmYP1E0doQDmYv/7DY5KSf2nKMpp 3pi2WCyY2gomLdGST0mvYp6ys6USByE8B1lWwZVsZJ9j5rKzOx1P6nhFw7ne+mkIQwHi bu+w== X-Gm-Message-State: ALoCoQnAf9s5hqY4lRzWxwbojn8t7t/V1nYdmKIJzECiFaMX0JKnNIrOce/A5I8s2c5GYLa6QP9m MIME-Version: 1.0 X-Received: by 10.202.202.4 with SMTP id a4mr17621726oig.5.1423048517084; Wed, 04 Feb 2015 03:15:17 -0800 (PST) Received: by 10.202.214.205 with HTTP; Wed, 4 Feb 2015 03:15:16 -0800 (PST) In-Reply-To: References: Date: Wed, 4 Feb 2015 13:15:16 +0200 Message-ID: To: Florian Margaine Cc: Leigh , PHP Internals Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] What do we need strict scalar type hints for? From: narf@devilix.net (Andrey Andreev) Hi, On Wed, Feb 4, 2015 at 1:02 PM, Florian Margaine wro= te: > Hi Leigh, > > Le 4 f=C3=A9vr. 2015 11:50, "Leigh" a =C3=A9crit : >> >> What was wrong with: >> >> function x(int $y, string $z) { // strict >> function x((int) $y, (string) $z) { // casting >> >> This was the best suggestion I've seen that covers the requirements of >> both camps, and is still very clear how data is going to be handled. >> >> Authors who want their APIs to adhered to strictly can do that, >> authors who want to accept anything and have it end up as their >> desired type can do that too. > > Because it is then the callee who decides, not the caller, whether or not > he wants strict typing. > ... and apparently, this is the root of all evil. :) I am baffled by how the two-syntaxes suggestion is always so easily dismissed by that argument. I'd argue that most people who support the current proposal don't fully understand what declare(strict_type=3D1) really does. As I've previously said - putting the caller in control (and really the caller, not in a per-file context) makes it a debugging tool, not support for strict typing. Cheers, Andrey.