Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:103264 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 12154 invoked from network); 26 Sep 2018 19:49:28 -0000 Received: from unknown (HELO mail-pl1-f180.google.com) (209.85.214.180) by pb1.pair.com with SMTP; 26 Sep 2018 19:49:28 -0000 Received: by mail-pl1-f180.google.com with SMTP id b5-v6so691030plr.5 for ; Wed, 26 Sep 2018 08:57:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=mindplay-dk.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=xFPTI847cEuCM/Sn89BvCzrGjbbuCewJt+Km4OI6BJ8=; b=QPhZsPbE5lfMkT241p68iY6AFOBBlHOQieJCQrWxuxLCRAUewKfx/qajMyBT4zNuEl clr7x8l0ZUSIrBZfaGv3TmWuUVPZuvdYdYtuY39Yl/Zd/PND0jYU/JTgcGUnCxOJKeq2 c5uscR+McVz7OIVoGEwHCMUwbWmaAcYiODhb6cqCLaknl9rMZ67E0q1w+EDO8QpgdfUK AynBlGuVvSSdBv0j/a29KJggwECftmPuOdLHBjIppkZ1sdrhCBBl2J4w+NRK8KrT9aJM fZPUMwT3XD/TfGTQVsQiUknc/dMg3eDvfyqrXhFNFRX+xOmKbRLzjxwmxLh+avfHXmQQ /ZRw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=xFPTI847cEuCM/Sn89BvCzrGjbbuCewJt+Km4OI6BJ8=; b=HCM6AbnHH/rBCb9SA1p3x2G8d8WtGAsU2Ge4l/CZzfyad7RXKXixV3gjOoOykLWDdJ jmAVqaSzRAYWGWu+ZkcfMTsjrYiUftuTJ9PI7+J7cAuAiM68K/pnHl5tsqVHiiRuJraf ejbqzyx0OK/Newc72hA/J+Mp3p/7zB++99eih08VQpOoT6gdNtKx4RzCiDQTPjUBgJn4 smu11n8UtJ12960mxlVV7wP4AYsY0EEj05FPH6ts8SqHKnQz9UAtR36Baa6m46wgg5f8 RaCW0XSTnzcyxLHh03vU7+rcL8uLoLu84w0U5Jmz6Ee0FcQ3p0+OhIdLvSTpGnDKnPcl s7+g== X-Gm-Message-State: ABuFfoiRdFNgSYUdAWFvZ+Aoy7biFLj5yOEM9Tv/IiHljj5srBXiY9Kw yUriIr6HvrhqS3foJlHGJLO3gl+a+U6xBNIbFpAIQQ== X-Google-Smtp-Source: ACcGV61Sx9TdltpzCxwKnmjgq/s5oaV14wRaA7OLFns2yDyjbOB0p01fSmwFXRY7KzF0nVKrMKpegdEjvBkVcYvpz0w= X-Received: by 2002:a17:902:4001:: with SMTP id b1-v6mr6722345pld.312.1537977457039; Wed, 26 Sep 2018 08:57:37 -0700 (PDT) MIME-Version: 1.0 References: <1537824239.902316.28693.59265@mail.rambler.ru> In-Reply-To: <1537824239.902316.28693.59265@mail.rambler.ru> Date: Wed, 26 Sep 2018 17:57:29 +0200 Message-ID: To: andrewgrom@rambler.ru Cc: PHP internals Content-Type: text/plain; charset="UTF-8" Subject: Re: [PHP-DEV] Re: Pre proposal for "Class extension functions" From: rasmus@mindplay.dk (Rasmus Schultz) On Mon, Sep 24, 2018 at 11:24 PM Andrew Gromov wrote: > > Bring a little Javascript into PHP? > > In fact, I looked at Kotlin :) Kotlin does not modify classes. This sort of thing is sound in compiled languages like Kotlin and C#, where this is really syntactic sugar for calling user-defined functions with object-like syntax - it's possible (and sound) *only* because these languages can resolve such calls at compile-time. In dynamic languages like JavaScript, you're literally writing to a map of methods, which means execution order is critical, and overwrites are possible - just two reasons why this feature isn't sound in languages like JavaScript, and wouldn't be in PHP either. What's wrong with just calling a function and passing the object as argument? In my opinion, this is the kind of pointless feature that brings nothing new and invites inconsistent code and bikeshedding over pointless details.