Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:81606 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 67784 invoked from network); 2 Feb 2015 16:47:52 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Feb 2015 16:47:52 -0000 Authentication-Results: pb1.pair.com smtp.mail=dragoonis@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=dragoonis@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.216.53 as permitted sender) X-PHP-List-Original-Sender: dragoonis@gmail.com X-Host-Fingerprint: 209.85.216.53 mail-qa0-f53.google.com Received: from [209.85.216.53] ([209.85.216.53:43966] helo=mail-qa0-f53.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id FE/E6-34915-73AAFC45 for ; Mon, 02 Feb 2015 11:47:52 -0500 Received: by mail-qa0-f53.google.com with SMTP id n4so29951977qaq.12 for ; Mon, 02 Feb 2015 08:47:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=3sEW8Bb7A/78Xiu5eltlo81jL5JSpfa4p68VCKYo2Wk=; b=efUkBoa/lX3TPm3XfjCK+77a/04JMCWBGvs6hyYuSlntuF2PGkOhByHe5OG+3Xw/0Q HsLzzCZMP8RsMfPriJtBhyJho97hD0Jve51MI3arYhYvZiLQ0NIZZjSwwusPOfaEqgI1 pWfBF8O/YLalwDqJcJMSkwpGnQh1WoWZ312KDw0WXwPMcGK12QjWbVLGDfW18dsIC0+V WEtPfDgA9IYGFMLGbvg14EeUMUC5RuHdKwB/yIZ4sLpI2BVGIeJGHDnEc9/adwizHwvR OTLZkLMrAnuMowMDheLTcieFZkjgPXIfMjHMV/KxOTe9hs/Gdm8w5qaHeCzXMRrJYKiG VJHQ== MIME-Version: 1.0 X-Received: by 10.140.40.211 with SMTP id x77mr40197862qgx.25.1422895669445; Mon, 02 Feb 2015 08:47:49 -0800 (PST) Received: by 10.229.157.11 with HTTP; Mon, 2 Feb 2015 08:47:49 -0800 (PST) In-Reply-To: References: Date: Mon, 2 Feb 2015 16:47:49 +0000 Message-ID: To: Dmitry Stogov Cc: PHP Internals , Andrea Faulds , Nikita Popov Content-Type: multipart/alternative; boundary=001a11c13bf2ee0cb5050e1db6d7 Subject: Re: [PHP-DEV] What do we need strict scalar type hints for? From: dragoonis@gmail.com (Paul Dragoonis) --001a11c13bf2ee0cb5050e1db6d7 Content-Type: text/plain; charset=UTF-8 Hi Dmitry, It's preferred to have flexible scalars, that way we can interchange between a numerical string or an integer. Over defining on such things loses the powerfulness of PHP. So scalar typehints are detrimental rather than useful. Saying something is a scalar or not, is useful however! :) A use case would be where scalar type hints are detrimental are: I implement an API that returns integers for entity ids, like 2,3,4,5,6. and my web-frontend handles this fine because it's a scalar. Then, you want to convert entity ids to UUID. This would break your entire web frontend application since it's no longer "integer" whereas the concept of $id is good enough. Did this make sense? TL;DR - I am against such proposals. Many thanks, Paul On Mon, Feb 2, 2015 at 9:12 AM, Dmitry Stogov wrote: > hi, > > could you please write down few use cases, when strict scalar type hints > are really useful. > > Thanks. Dmitry. > --001a11c13bf2ee0cb5050e1db6d7--