Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:58335 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 19106 invoked from network); 29 Feb 2012 14:46:18 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 29 Feb 2012 14:46:18 -0000 Authentication-Results: pb1.pair.com smtp.mail=linepogl@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=linepogl@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.160.170 as permitted sender) X-PHP-List-Original-Sender: linepogl@gmail.com X-Host-Fingerprint: 209.85.160.170 mail-gy0-f170.google.com Received: from [209.85.160.170] ([209.85.160.170:56067] helo=mail-gy0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 73/A3-33921-83A3E4F4 for ; Wed, 29 Feb 2012 09:46:16 -0500 Received: by ghbg2 with SMTP id g2so2752372ghb.29 for ; Wed, 29 Feb 2012 06:46:14 -0800 (PST) Received-SPF: pass (google.com: domain of linepogl@gmail.com designates 10.236.177.6 as permitted sender) client-ip=10.236.177.6; Authentication-Results: mr.google.com; spf=pass (google.com: domain of linepogl@gmail.com designates 10.236.177.6 as permitted sender) smtp.mail=linepogl@gmail.com; dkim=pass header.i=linepogl@gmail.com Received: from mr.google.com ([10.236.177.6]) by 10.236.177.6 with SMTP id c6mr923500yhm.42.1330526774330 (num_hops = 1); Wed, 29 Feb 2012 06:46:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type; bh=oSgrlgTTV7EE0zbd2fQwbqs2GMSzQ1zFUpEPpwdiB2I=; b=TDvINWPJ3+TkIFNR3tClfv9B0O6StLsJo6H7ZoCkC8z0I8U4gtt3Z63FU3drnD3Q6O 5N+SO5p2HP0HciFFnukSBcLPkRd7Fq/AuyXJiyyKk/VLU4I0omk46P9ot80Wh6dbR3mS hAGekQId30HeTkSXzq3wiux2cZXGS5fH3wGLo= Received: by 10.236.177.6 with SMTP id c6mr732226yhm.42.1330526774270; Wed, 29 Feb 2012 06:46:14 -0800 (PST) MIME-Version: 1.0 Received: by 10.147.125.8 with HTTP; Wed, 29 Feb 2012 06:45:54 -0800 (PST) In-Reply-To: References: Date: Wed, 29 Feb 2012 15:45:54 +0100 Message-ID: To: Anthony Ferrara Cc: internals@lists.php.net Content-Type: multipart/alternative; boundary=20cf30563901be998604ba1b67cd Subject: Re: [PHP-DEV] [Draft RFC] Object Casting and Assignment Handlers From: linepogl@gmail.com (Lazare Inepologlou) --20cf30563901be998604ba1b67cd Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Hello Antony, You did a nice work for the RFC. However, I have to disagree with the name __assign, because it limits the type casting operation only to assignments. An implicit type casting could very well happen upon calling a function with type hints. Therefore, I would suggest the use of something like __castFrom(mixed $value). Of course, this changes the semantics a little bit: 1. The function has to be static. 2. The function has to return the new object. I would suggest to check out C# implicit casting, which does exactly this thing (in compile-time however). Check this example: http://msdn.microsoft.com/en-us/library/z5z9kes2.aspx This way we don't mess up with the assignment operator. Meanwhile, there is another interesting RFC under discussion (check the thread "Scalar Type Hinting") which seems to be far more promising than overloading the assignment operator. Lazare INEPOLOGLOU Ing=C3=A9nieur Logiciel 2012/2/29 Anthony Ferrara > Hey all, > > I've created a draft version of the RFC for implementing __castTo() > and __assign(): > > https://wiki.php.net/rfc/object_cast_magic > > It's still a draft, and has a lot more work to do, but I figured this > would be enough to start triggering some discussion (or at least a > little bit more focused discussion). > > > > One plea: Please keep this thread on-topic discussing the RFC and its > implications... > > Thanks! > > Anthony > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --20cf30563901be998604ba1b67cd--