Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:98434 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 38735 invoked from network); 8 Mar 2017 16:51:01 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 8 Mar 2017 16:51:01 -0000 Authentication-Results: pb1.pair.com header.from=derokorian@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=derokorian@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.218.44 as permitted sender) X-PHP-List-Original-Sender: derokorian@gmail.com X-Host-Fingerprint: 209.85.218.44 mail-oi0-f44.google.com Received: from [209.85.218.44] ([209.85.218.44:32873] helo=mail-oi0-f44.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 47/A8-06022-47630C85 for ; Wed, 08 Mar 2017 11:51:00 -0500 Received: by mail-oi0-f44.google.com with SMTP id 2so22181528oif.0 for ; Wed, 08 Mar 2017 08:51:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=H7Ec7NZNc3FVgiWZ2yIoYX+DEH55p2xIt3w6uU/6CtM=; b=EWvq1Fnq3F/qABDFQ6ifWZUpJghA/bCG6ebvUyGfG7GX0WRZZx0nczWEg8pVxghx7s 4CBfocjYeLoTwlNwG6tAbr1GhsVnxfZ2Fl1mwSVJ0eJSAwkHjRvA6Rp8SclF57tN56Zs 1NN9mhGZ+50zCmSulLlwIGc2BNRcEh6LwjRIKlpeB0e0VY614pjVhPFvihPhzvpK/xhq k4dF92amojyVcSSH9PPlrkShM43Z1EZmqvZ60JTdj1TYojGMn+wkRgNSPUsMKvn09NfY d5bftCQop0/tNVUoixACiP0lEXvjh6TBKIGg66QAcgBe2SuL266XwEUfTRlYpvMLF6h9 q6AQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=H7Ec7NZNc3FVgiWZ2yIoYX+DEH55p2xIt3w6uU/6CtM=; b=IVNTpYFqlWvVPWxOdWYcqYR/2WG6F1rehbyup2+XYRWU2kW4EBDCNeP5eD0NIn8yTf GSOve/3QQJNUsp32olHjTEleFkGfALsaNQid32WZ5qaavXyAM+M+7oVupCX/Z/UJnRG2 e89dQWbkh1Rv7so38FlPjcqqZRlmowBODKnoS1OP+1B0tOWK7iho8FuxjjaaMPlVigms bww28A3nhOjNiuzCIEz3AqK/nDAk6l+68aNTLpvx3hX8oI9XCLfZ31/T1ei+xgrfElWK c6z/pjEdhlPu7qsWyP7z8g30OQLI9vlvARdAfUVXuh/fA/do2TA9FD/RGf/XuPOVMYb6 yXVQ== X-Gm-Message-State: AMke39l4eWVB1rz9M/ZYbholJk5ZLdVxDpekp5/b96FmKH4MaFm0uPP/bR00hcG+W+t+uHREf7ZW0YdQsEhC9w== X-Received: by 10.202.204.86 with SMTP id c83mr4201964oig.146.1488991857755; Wed, 08 Mar 2017 08:50:57 -0800 (PST) MIME-Version: 1.0 Received: by 10.157.11.227 with HTTP; Wed, 8 Mar 2017 08:50:57 -0800 (PST) In-Reply-To: References: <996dc359-cbc1-1c76-dacc-f748d0941aa6@fleshgrinder.com> Date: Wed, 8 Mar 2017 09:50:57 -0700 Message-ID: To: "internals@lists.php.net" Cc: Andrey Andreev Content-Type: multipart/alternative; boundary=001a1134feccc14bf0054a3aee98 Subject: Re: [PHP-DEV] [Discussion] is_string(), string type and objects implementing __toString() From: derokorian@gmail.com (Ryan Pallas) --001a1134feccc14bf0054a3aee98 Content-Type: text/plain; charset=UTF-8 On Wed, Mar 8, 2017 at 9:50 AM, Ryan Pallas wrote: > > > On Wed, Mar 8, 2017 at 8:51 AM, Fleshgrinder wrote: > >> Hey! :) >> >> The reference is actually not a problem for a Stringable because you >> would get the "Only variables can be passed by reference" error with an >> object if `strict_types` is enabled. >> >> Simply because the object **MUST** be converted into a string. The >> object itself does not satisfy the constraint, but the object clearly >> states that it can be converted into a string at any point. >> > > This is the part I disagree with. The object clearly states that it can be > turned into a string when you are done using it as a object. If it gets > turned into a string, you can no longer use it as a object. > > There is a difference between changing an int to string and an object to > string, in that afterwards the int->string can continue to be treated as an > int afterwards, thanks to loose typing (otherwise it wouldn't have become a > string in the first place). However with an object->string afterwards it > can ONLY be treated as a string, it can no longer be treated as an object. > Meaning > > $int = 3; > foo(3); > Sorry this should have been: foo($int); > var_dump(++$int); // 4, success, no errors > > $obj = new Foo('a'); > foo($obj); > var_dump($obj->method()); // Fatal error: call to member function method > on string. > > To me, this doesn't make sense. > >> >> Not doing so would violate what `strict_types` actually promise us. ;) >> >> -- >> Richard "Fleshgrinder" Fussenegger >> > > --001a1134feccc14bf0054a3aee98--