Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:82970 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 40163 invoked from network); 17 Feb 2015 15:11:22 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 17 Feb 2015 15:11:22 -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.214.177 as permitted sender) X-PHP-List-Original-Sender: narf@devilix.net X-Host-Fingerprint: 209.85.214.177 mail-ob0-f177.google.com Received: from [209.85.214.177] ([209.85.214.177:33133] helo=mail-ob0-f177.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 3F/3A-19463-91A53E45 for ; Tue, 17 Feb 2015 10:11:21 -0500 Received: by mail-ob0-f177.google.com with SMTP id wp18so52023371obc.8 for ; Tue, 17 Feb 2015 07:11:18 -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; bh=Q46tZGP0lmpYmCC0JseGZtSj+OJm8XTnqnlaRbrq7+E=; b=qwDzbZCpOoP8hPGH5tcvAtT1XPt3OWPXlfZ3D7G8rYy+tZN3Ba9LVEPWr+YSe9EhKn lXhy4OEvIV3cAK4YldI4H/rxItI7hrMWsE3dDPFjZgfrbg9fLBGaZP7jDwYOY+Jjoj4U BZJ+9CIYDmiplLMVNrKbTPao51TdEuB/QiznE= 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=Q46tZGP0lmpYmCC0JseGZtSj+OJm8XTnqnlaRbrq7+E=; b=LkOdnCQxAYL4DSXHBKlAfaJqZ+u307B9MB3IgvqcjcPBNDqt49p7T83WwC58eldDam OA9P6yWZIfWVHU2xCWBCsPTdoXbfkWsXHG9NMw3Ee3A+yT4Eid6dOcgBmLfJ6bgGK5NM BEs7JCUNpAmvuvrkh8GnqLpTCptQsW6DAUjr+NGl4FfPs4P1lsXncjMSFTzP/1Q9aVek +tmE4R1zeDeYeEtuJzMuDBtcVsqkZC8w0oM1mFKukhlz3MDdcXSmicSRRuN7cSlyY4vE utke/q8G+cqCAvzqhS/+J857QlvrXUwg8ueZnhvkq+GvE5L1trdnNfWv2KPjDNhKLkYv ww0g== X-Gm-Message-State: ALoCoQnc+7iMWLdcwu5BFfiEpayRb2q81L65p8ncbQi4ANtC/62sJh1mPilJ8QNShtoQVsprZ1eL MIME-Version: 1.0 X-Received: by 10.60.161.10 with SMTP id xo10mr19258489oeb.56.1424185878136; Tue, 17 Feb 2015 07:11:18 -0800 (PST) Received: by 10.202.214.205 with HTTP; Tue, 17 Feb 2015 07:11:17 -0800 (PST) In-Reply-To: <54E35808.30609@birkholz.biz> References: <011801d04a07$83ab1c00$8b015400$@php.net> <016f01d04a3a$e9183220$bb489660$@php.net> <54E290E5.3020508@lerdorf.com> <54E2AD88.6040206@lerdorf.com> <54E35808.30609@birkholz.biz> Date: Tue, 17 Feb 2015 17:11:17 +0200 Message-ID: To: Dennis Birkholz Cc: "internals@lists.php.net" Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] Reviving scalar type hints From: narf@devilix.net (Andrey Andreev) Hi, On Tue, Feb 17, 2015 at 5:02 PM, Dennis Birkholz wrote: > Am 17.02.2015 um 12:30 schrieb Leigh: >> And you find taking authority over a library away from the library >> author completely acceptable? >> >> If I write an API that works perfectly well in strict mode, why >> shouldn't I be able to turn strict on for my whole library? Do I just >> tell users that non-strict mode constitutes undefined behavior for >> this library, and refuse to fix any bugs that come up because of it? > > As the library author you will never ever notice if your library was > called in strict mode or not! And that is the point: you will not get > any gain from making all your parameters strict, you will just force the > user to cast (as Rasmus said already). > > Repeating that strict mode is required from a library author's point of > view does not make it right. You always get the types you want, you just > limit the library consumer. > > But you may want your code call other functions in strict mode to catch > some type errors, that is perfectly valid, I don't deny that. > What you've said has been repeat tens of times already. Many of us just disagree with that rationale, because it's missing the point. Nobody is stupid enough not to know that they always receive the specified type. There's just a big difference between knowing that you will receive a i.e. boolean, and knowing that the user *passed* a boolean. Cheers, Andrey.