Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:92054 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 95226 invoked from network); 31 Mar 2016 18:24:33 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 31 Mar 2016 18:24:33 -0000 Authentication-Results: pb1.pair.com smtp.mail=guilhermeblanco@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=guilhermeblanco@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.218.50 as permitted sender) X-PHP-List-Original-Sender: guilhermeblanco@gmail.com X-Host-Fingerprint: 209.85.218.50 mail-oi0-f50.google.com Received: from [209.85.218.50] ([209.85.218.50:34334] helo=mail-oi0-f50.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 7D/B2-15473-F5B6DF65 for ; Thu, 31 Mar 2016 13:24:31 -0500 Received: by mail-oi0-f50.google.com with SMTP id o62so71969687oig.1 for ; Thu, 31 Mar 2016 11:24:30 -0700 (PDT) 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=374MWvMLvvbOwPwPWGYpCzBQnTpaOcY6SHrvUaHn4qk=; b=PP0MVe2VPzgee/pVKJ97RQWfSj2WUazraA3dyQ8v6729tKPyZi6cEBHYm8tZfyOqjt 5QvEXflzkyvrl48C2iKQW1yCHKSGyKfiv4/O22PYcst3jTm0gKuVIHAK+xm0PBKtA4mU veBCr9G/hXLwqCFcSOmrkwHsluBrYw/+B6j6552BZ9jjEEBuAEbKNJ3mfXrkSC0pFQxv SM3P91NlrG32mDYvxFSIY76Io55mH1W2l0D3KqQ88xGOoirWzE+L34I++5XgvGsKzwMA 0ecIII6L267Z+ILvPVZSw61z1h4e1atk1ykuMRCJQUQmvKOnQLU2O3beeHaCFKKJy0ZB AqFg== 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=374MWvMLvvbOwPwPWGYpCzBQnTpaOcY6SHrvUaHn4qk=; b=JgDVyuUaLRj7RIDzmhW7WyDkHPe9mH0R2tyH6fNGFetf8CxLCAcc6d0gyslAp2rfQv hWCgII9ZmALVIZAyaZVLksBzg+b2SrdCxAqC8xpZF61DRmXG6PqnoPgwTRZgou/FijRE 6swU+NNxMN/ZzeDwgxQSQHNqS2DXtAl1iwDMCHqPP9PIc18YvqPcOIQy0IFCOaNXvcOw j9Hvl10R8x8aHHZ/URNwXlnp2VDvUip8D9TMZw7vuJ3pc26+B05eyh8C5JvEPMFp97Up 4paVXt3abWi+pmOydzmwKdW+iyV/OSDNi/RG6zu3G/vRb2zxuSFshk407vHf9q1+k1FT hjRA== X-Gm-Message-State: AD7BkJLl5EcnJ6IWSlc1nOgGr7wsVy3ACnN7JfvORom0y/R0N/bC40C1Zu+Q/hVJIeTqzQPoJCA59NJrWpaz0g== X-Received: by 10.157.20.207 with SMTP id r15mr2286588otr.173.1459448668588; Thu, 31 Mar 2016 11:24:28 -0700 (PDT) MIME-Version: 1.0 Received: by 10.76.38.162 with HTTP; Thu, 31 Mar 2016 11:24:09 -0700 (PDT) In-Reply-To: <56FE7A8F-B093-49AA-BC19-FCB28701855A@zend.com> References: <56F16023.1010002@gmail.com> <56FC4ED6.6050701@telia.com> <56FCE6C9.1050302@zend.com> <56FD4E18.7070703@garfieldtech.com> <56FE7A8F-B093-49AA-BC19-FCB28701855A@zend.com> Date: Thu, 31 Mar 2016 14:24:09 -0400 Message-ID: To: Zeev Suraski Cc: Larry Garfield , PHP internals Content-Type: multipart/alternative; boundary=001a113cd5b875b8c7052f5c5f64 Subject: Re: [PHP-DEV] [RFC Discussion] Typed Properties From: guilhermeblanco@gmail.com ("guilhermeblanco@gmail.com") --001a113cd5b875b8c7052f5c5f64 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable My code version is not complete, as the references changed when you include the optional_type. It shouldn't be hard to change though... like $$ =3D $3 and also hold $2 somewhere. On Thu, Mar 31, 2016 at 2:09 PM, Zeev Suraski wrote: > > > On 31 =D7=91=D7=9E=D7=A8=D7=A5 2016, at 20:48, "guilhermeblanco@gmail.c= om" < > guilhermeblanco@gmail.com> wrote: > > > > To me it's simply as that: > > > > > > class_statement: > > variable_modifiers optional_type property_list ';' { $$ =3D $2; > > $$->attr =3D $1 } > > | ... > > > > property_list: > > property_list ',' property { $$ =3D zend_ast_list_add($1, $3); } > > | property { $$ =3D zend_ast_create_list(1, ZEND_AST_PROP_DECL, $1= ); } > > ; > > > > > > I think this makes the concept more palatable compared to others and > other > > languages (single type declaration per statement). > > > > Exactly (code version). > > >> Honestly I never even realized that you could put multiple declaration= s > on > >> a single line, have never done so, and would reject code from any of m= y > >> projects that did so as poor style. :-) That said, since it is legal = I > >> agree that it should be kept unambiguous and consistent. > >> > >> From what Zeev is saying, the following seems like a reasonable rule: > You > >> get ONE visibility modifier and ONE type statement per declaration, an= d > >> both must come at the beginning, period. That is, the following are > legal: > >> > >> public int $a, $b; > >> protected $a, $b; > >> var int $a, $b; > >> > >> And always apply across the entire line, period. > >> > >> The following are all syntax errors: > >> > >> public int $a, string $b; > >> var int $a, protected $b; > >> private $a, float $b; > >> > >> That seems fairly easy for a reader to follow, reasonably consistent, > and > >> I presume straightforward to implement (not being a C developer I > hand-wave > >> that part...). If you want to do something more complex... make it > >> multiple statements. That's why multiple statements exist. > >> > >> Zeev, is that an accurate summary of what you're arguing? > >> > > Exactly (human version :) > > Zeev > --=20 Guilherme Blanco MSN: guilhermeblanco@hotmail.com GTalk: guilhermeblanco Toronto - ON/Canada --001a113cd5b875b8c7052f5c5f64--