Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:97257 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 83591 invoked from network); 2 Dec 2016 14:51:44 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Dec 2016 14:51:44 -0000 Authentication-Results: pb1.pair.com smtp.mail=bowersbros@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=bowersbros@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.210.181 as permitted sender) X-PHP-List-Original-Sender: bowersbros@gmail.com X-Host-Fingerprint: 209.85.210.181 mail-wj0-f181.google.com Received: from [209.85.210.181] ([209.85.210.181:33749] helo=mail-wj0-f181.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 5A/9A-01781-08A81485 for ; Fri, 02 Dec 2016 09:51:44 -0500 Received: by mail-wj0-f181.google.com with SMTP id xy5so234014204wjc.0 for ; Fri, 02 Dec 2016 06:51:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=nB7DTE97BsyOf+V3lj1yZnY300g5OxuQ9qFgkGtbsdA=; b=JVRP8UNgMvka4+gCCCc+Qu08C+EMfAldnTfJyaQDze7hQHpkb7BLjNszjd4bLawvJs +8o6u0g9SHuofijN4SXLMIKYR5EwXnhw3nWZ9OMClvsE8p4Gv3lalLhifwRix68rDAZL jCxEKghTq6T7T4vIpNmyhcjmm/24uQos4BYEs+90nasagTl3UJUpJEna2Xk1hy0//VPA ODv+cbcYZxQ2vAwORF6P0W2BJ6UmlBcpouuJG3j9zrFyavEabU8xQvaovVSBf1UxeEg+ UMswBrASl5AFHU2CcwkzGAifa8UbU1you+0QREdyeB+B1Ry8Er0dG3UgNGZTqNlBG24B wtFw== 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:from:date :message-id:subject:to:cc; bh=nB7DTE97BsyOf+V3lj1yZnY300g5OxuQ9qFgkGtbsdA=; b=NEKWc68ZdVPSmHTf29KYR5sl5TgEqwcqiwa5Mnl/63djUbTbO+2Vm4Fv94NJp/uN6q lR/1R2rn5erFIfBq8iNM5Hja5hus1tkbdKvxRzR4jh77vnzw1gL50FO2bq34RYPF6KCB 2zlfVC+CVk2L61x2vSQ4JTjAr2ia1+7/SHUHsRjx8Fx+u+irwmR+O6lbFhSWY7DkT9Rs /MMhphCeBFsjCd9tAPKJcLnQs7NE2Xku2VxDGwVUZj5NdVKEE9SpbZqj59UsfFS0y8FK F11yPw59BoHNmpiJA2J1X8K2aXiw6cXW2xGtlGSZBP7wsy1kaloJ6VeFcZRWB7jGZnrk KikQ== X-Gm-Message-State: AKaTC00t9Msng4NlVo7mxvoGJiEofgOCeJ7TF+nsEUnuC5d9yragVu7MKhOg16ivUEeSIf3+SCV1khJ6KAYgig== X-Received: by 10.194.221.4 with SMTP id qa4mr45213045wjc.179.1480690301513; Fri, 02 Dec 2016 06:51:41 -0800 (PST) MIME-Version: 1.0 Received: by 10.28.232.77 with HTTP; Fri, 2 Dec 2016 06:51:40 -0800 (PST) In-Reply-To: References: Date: Fri, 2 Dec 2016 14:51:40 +0000 Message-ID: To: Andrey Andreev Cc: "internals@lists.php.net" Content-Type: multipart/alternative; boundary=001a11c3ae5e71b9c10542ae13c5 Subject: Re: [PHP-DEV] Re: [Concept] Magic Casting From: bowersbros@gmail.com (Alex Bowers) --001a11c3ae5e71b9c10542ae13c5 Content-Type: text/plain; charset=UTF-8 Damn. I must have done that to a lot of emails. Gonna have to resend them all when I get home. Sorry folks for dupes. On 2 December 2016 at 14:46, Andrey Andreev wrote: > Hi again, > > On Fri, Dec 2, 2016 at 4:19 PM, Alex Bowers wrote: > >> I don't see how the interface is equivalent. >> >> The benefit of this, is that you can convert types passed into a method >> to the type you expect automagically, Castable wouldn't allow that, only a >> new magic method (or reflection and user land code possibly?) would allow >> this. >> > > A magic method is essentially an implicit interface ... > The interface itself does nothing. But when it is implemented, the engine > will know that the class constructor is public and accepts a single > parameter - thus, also knowing that it could try to do a new > ClassName($yourParameterHere) > > >> >> As for the limitation of only one parameter being accepted, what would >> the other possible parameters be? >> >> Since this is based entirely on the casted variable, there can only >> possibly be one variable there, the one passed into that position in the >> functions arguments. >> >> > What I meant is - you cannot cast to a class that requires more than one > dependency to be instantiated - that's the obvious limitation. > > >> Arguably, this feature would resolve some bugs in peoples code, because >> it can allow better enforcing of types. >> > > It enables magic behavior, that's the opposite of enforcement ... If you > want to enFORCE something, you force the developer to do something, you > don't auto-magically do the thing for them. > > P.S.: I suppose you've hit "Reply" instead of "Reply All"? I was the only > recepient of the message I'm quoting. > > Cheers, > Andrey. > > --001a11c3ae5e71b9c10542ae13c5--