Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:84394 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 52741 invoked from network); 7 Mar 2015 02:15:04 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 7 Mar 2015 02:15:04 -0000 Authentication-Results: pb1.pair.com smtp.mail=yohgaki@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=yohgaki@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.182 as permitted sender) X-PHP-List-Original-Sender: yohgaki@gmail.com X-Host-Fingerprint: 209.85.214.182 mail-ob0-f182.google.com Received: from [209.85.214.182] ([209.85.214.182:37496] helo=mail-ob0-f182.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B1/E0-39204-52F5AF45 for ; Fri, 06 Mar 2015 21:15:02 -0500 Received: by obcwp4 with SMTP id wp4so17323481obc.4 for ; Fri, 06 Mar 2015 18:14:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc:content-type; bh=d/kl4W4FqngH3mQBQmGCnL1+YuiKf/NfVbL0bMtP+lQ=; b=wptSLLMt21Nbd2AuW/FJ2HiT3zxSFymkYcHwCPES3EMiIfeUzs7YqcbnM+fU8/7uZP 98RoEw+lCFvx/70CNkLElDR1YPvzJpgtnfXzxBw3qYMEnBNPXdUemtNcIgWqDz/j7x7m yDLtqgbwUSxt8y9qWaDtKomXE/uN1l7z604+qATixtKktrs35NI8RoJnHxo3w2vzijre uK49l3FEIR1i3uJA7+6tl9psKSmOIIefDoLYBWPW8aytrvbi9eNPm1dwduIVKMANgq8d n4HuBY5bFBzHH27FWjd0OhdzfILXhcEJl4fzF/37a794tTwlCYM7mxbY9UDCuj0Xrc4q kGYg== X-Received: by 10.202.45.214 with SMTP id t205mr12706774oit.100.1425694498735; Fri, 06 Mar 2015 18:14:58 -0800 (PST) MIME-Version: 1.0 Sender: yohgaki@gmail.com Received: by 10.202.58.2 with HTTP; Fri, 6 Mar 2015 18:14:18 -0800 (PST) In-Reply-To: References: Date: Sat, 7 Mar 2015 11:14:18 +0900 X-Google-Sender-Auth: niaImNS0_C-We7Lvpcld8lx_lE4 Message-ID: To: "S.A.N" Cc: Philip Sturgeon , Mike Willbanks , PHP Internals Content-Type: multipart/alternative; boundary=001a1138ea2427cccc0510a95e23 Subject: Re: [PHP-DEV] [RFC] Anonymous Classes From: yohgaki@ohgaki.net (Yasuo Ohgaki) --001a1138ea2427cccc0510a95e23 Content-Type: text/plain; charset=UTF-8 Hi all, On Wed, Feb 25, 2015 at 4:06 AM, S.A.N wrote: > Yes, is problem - properties and methods look the same, how to solve > this problem in PHP I do not know. > Perhaps PHP could interpret this code: > $object = > { > 'property' => $value, > 'method' => function (){...} > }; > > AS > > $object = new class > { > public $property = $value; > public function method (){...} > } > > Use case - inline object without inheritance and traits, only the > properties and methods it brief and easily understood JSON syntax, I > think it would be popular with developers of PHP. > It's not directly related to the topic, but I would like to have "code block" that returns "value" with this syntax rather than defining anonymous class/object. BTW, I'm +1 for the idea having anonymous class. Regards, -- Yasuo Ohgaki yohgaki@ohgaki.net --001a1138ea2427cccc0510a95e23--