Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:99790 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 39834 invoked from network); 6 Jul 2017 07:59:29 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Jul 2017 07:59:29 -0000 Authentication-Results: pb1.pair.com header.from=michal.brzuchalski@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=michal.brzuchalski@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.128.179 as permitted sender) X-PHP-List-Original-Sender: michal.brzuchalski@gmail.com X-Host-Fingerprint: 209.85.128.179 mail-wr0-f179.google.com Received: from [209.85.128.179] ([209.85.128.179:35584] helo=mail-wr0-f179.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id FF/98-15131-0EDED595 for ; Thu, 06 Jul 2017 03:59:28 -0400 Received: by mail-wr0-f179.google.com with SMTP id k67so17336369wrc.2 for ; Thu, 06 Jul 2017 00:59:28 -0700 (PDT) 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=YYiKXWUrIr4lFczDGklk3yfqYhm5t93zqVC3UcX+EEY=; b=oUnVGAGyQYW+g1B7Ra9yV0CM9bnjw8N6W+exnaXys0F2JLi3PEX1fHewKr2M60Eu9b hFXRrlFGOJftR2GAbfAf8qWRjamW+Zd0dWE4MqTcFtGMO62rbsyhAZZDxPKqx33QIsQi RbD9rZkjYoDJxF5Bt7O4B+WpUgJWDnCOBwUJ4rrawd7SwV+6SRuGeI0Vw4Dp+cLpJE+2 Ot7lJrNJj0Zt0ehF4gsn4EIgSFxwIZ8AjvCMs44B6oq6pppe2D6ZmWCNgarZKWRz1MQW lOH2kX/eKzFWPnIPW1A1T30+RFu2yRKYcbxmCf9MK+xLW04P2T698yKukhCMfjqBX+4N J/MQ== 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=YYiKXWUrIr4lFczDGklk3yfqYhm5t93zqVC3UcX+EEY=; b=SBF4Uv82fZneYpG9EQQuWexg6o/qecaoGKc5WFP45OJ8ogEbWu77YL3qSokQnZZTTv TEtT001aZ8dbsexkg7xJRA5wnHuKWIYe/yPg33D2NyTaAhD9FLAR0d2btGQ+XHuQyqes xL6qiUEIJLcprWB7nztHbOd8dzQhUabQfz6Ul7EKeOa4i/8CsF7EcCWuzKCZBHg9Yoxh e2pZOeLpyGU9wLa14g0HoYxqjPTSJ7MQXyLp1tmsrAMsDQ2iHQnxOBQZT2y0VtfWiwhd 1hNooIBmD+RdLSgSa9UUvzbNX6lRDpjbkWGYCA5c/7BLGvITc8HQGXsMnvT388mOTUWv tx0A== X-Gm-Message-State: AKS2vOw2DglE2Qw3cerhGfp9iAJV0+CPEkq2b2E+FPuMFGZskdJK6sfv s+ZQZPm58fgVm6q9fPNsM7ZcneYh9Q== X-Received: by 10.28.137.146 with SMTP id l140mr33576500wmd.101.1499327964569; Thu, 06 Jul 2017 00:59:24 -0700 (PDT) MIME-Version: 1.0 Received: by 10.223.134.13 with HTTP; Thu, 6 Jul 2017 00:59:23 -0700 (PDT) Received: by 10.223.134.13 with HTTP; Thu, 6 Jul 2017 00:59:23 -0700 (PDT) In-Reply-To: References: Date: Thu, 6 Jul 2017 09:59:23 +0200 Message-ID: To: Niklas Keller Cc: "Khawer ." , PHP Internals List , Stephen Reay Content-Type: multipart/alternative; boundary="001a114447f6baf44c0553a17e0e" Subject: Re: [PHP-DEV] Change -> to dot(.) From: michal.brzuchalski@gmail.com (=?UTF-8?Q?Micha=C5=82_Brzuchalski?=) --001a114447f6baf44c0553a17e0e Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 06.07.2017 09:43 "Niklas Keller" napisa=C5=82(a): > > Stephen Reay schrieb am Do., 6. Juli 2017, 09:04: > > > > > > On 6 Jul 2017, at 13:13, Khawer . wrote: > > > > > > In all major programming languages we access object properties and > > methods > > > using dot(.). > > > > > > C#: > > > Abc Abc =3D new Abc(); > > > Abc.method(); > > > > > > Java: > > > Abc Abc =3D new Abc(); > > > Abc.method(); > > > > > > JavaScript: > > > var apple =3D new function() { > > > this.name =3D "Test"; > > > } > > > alert(apple.name()); > > > > > > > > > Why not to make PHP similar to these languages by allowing to access > > object > > > properties and methods using dot(.). We will still keep "->" until PHP 8 > > to > > > maintain backward compatibility. > > > > In each of those languages, the plus operator is used for string > > concatenation. > > > > In PHP the dot operator is used for string concatenation, and objects can > > be cast to strings when concatenating, so how do you differentiate the two > > calls at the end of this block: > > > > class Bar { > > public function baz() {=E2=80=A6} > > > > public function __toString(): string {...} > > } > > > > function baz(): string {=E2=80=A6} > > > > $foo =3D new Bar(); > > $foo.baz(); // call method Baz on object $foo > > $foo.baz(); // concat the result of casting $foo to string, with the > > result of calling baz() > > > > Obviously by using plus for concatenation. That would be huge BC break because plus on string which ale numerical is adding numbers so result fir now would be sum. Not concatenated string. > > Regards, Niklas > > > --001a114447f6baf44c0553a17e0e--