Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Delivered-To: je******@gmail.com
- Received: by 10.12.165.132 with SMTP id z4csp323576qvz;
- Sat, 5 Nov 2016 08:35:24 -0700 (PDT)
- X-Received: by 10.28.8.149 with SMTP id 143mr1886854wmi.47.1478360124345;
- Sat, 05 Nov 2016 08:35:24 -0700 (PDT)
- Return-Path: <cm******@gmx.de>
- Received: from mout.gmx.net (mout.gmx.net. [212.227.17.20])
- by mx.google.com with ESMTPS id s15si21127052wjd.254.2016.11.05.08.35.24
- for <je******@gmail.com>
- (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);
- Sat, 05 Nov 2016 08:35:24 -0700 (PDT)
- Received-SPF: pass (google.com: domain of cm******@gmx.de designates 212.227.17.20 as permitted sender) client-ip=212.227.17.20;
- Authentication-Results: mx.google.com;
- spf=pass (google.com: domain of cm******@gmx.de designates 212.227.17.20 as permitted sender) smtp.mailfrom=cm******@gmx.de
- Received: from [192.168.2.103] ([79.243.119.150]) by mail.gmx.com (mrgmx103)
- with ESMTPSA (Nemesis) id 0Lqyi7-1cXyAK33hr-00eemN for
- <je******@gmail.com>; Sat, 05 Nov 2016 16:35:23 +0100
- Subject: Re: Traits and "horizontal composition of behavior"
- To: Jeff M <je******@gmail.com>
- References: <CAHVzS2LY_AEovMcB1h1EAwfGnaCqPkB8AoBNPTjqnavznFx4XA@mail.gmail.com>
- <c44ab11e-b020-bf00-9644-e7b53c4d5dc7@gmx.de>
- <CAHVzS2+qZ_87p7QS62+ngsAb1NTwoTb6guDUS0PaZhHBG0KALQ@mail.gmail.com>
- From: "Christoph M. Becker" <cm******@gmx.de>
- Message-ID: <00cf5e93-41a4-3c3a-1fc1-9e52648b7e73@gmx.de>
- Date: Sat, 5 Nov 2016 16:35:40 +0100
- User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101
- Thunderbird/45.4.0
- MIME-Version: 1.0
- In-Reply-To: <CAHVzS2+qZ_87p7QS62+ngsAb1NTwoTb6guDUS0PaZhHBG0KALQ@mail.gmail.com>
- Content-Type: text/plain; charset=utf-8
- Content-Transfer-Encoding: 7bit
- X-Provags-ID: V03:K0:Nc4hNPHnSrBAr2hXvOmRSdxGuGByQftPGbz8qeeyu0LhSBF52H6
- Mfz7ohenSB4kfx6nv0ei//U8FpqddE8VZvtpYrPuPOqA9bF4fZoWZBgHyz95L4IFg5f/YV0
- CT4r3dBjmdS+vGvd1I7L8qDTKf/QSG+YF7cRe8Qj8gSKvT4TT6CtkUrnnkBgyQNa00IlQm0
- h72fBCgKydJCm4C7A3s8g==
- X-UI-Out-Filterresults: notjunk:1;V01:K0:NXO2MRlqmHE=:hUr4gwxkiz8l3r225w/eG0
- 6NWXomY63/kFNvLJi5ASUDPmUaRkfAAg0xN/n8y5Z2a6yEXIWQELb+1nTo42sRw+ZsRn1FqFB
- 95iso76U+Y0F/O13VaQOGPTguNV36YN9BwHEFqRC3oDIQYPnqCswpO0qtWSg1GZ/15I5Ezh1u
- lvJ9rONzdzUhdW1X+VcrUG8KC4dBmiRtC17KP10InEMYscdxlm27unDxqBWiqoVzk8wGrr6Ss
- mYYYrGLtVd4NaTKmKMWbwxHm5wl3zWFHpxz/9AFmGxv8hDHjqHt9bhUuQP3nqpW4HBpsqnKuv
- 07OK66YBTfMzDqZgTkkRE5Y1tb77gb9rjiaHVZaFhtKoeCXQ0cAsAvVypdHdTi3lOYYBOyI9m
- KaYtRnn82wsqGI1K+OGeQgktqak+eMUcapk1KW2yoD2a8LTI7uGvL5bdh+z7njmRMqVenuV0V
- ix3DGMphgEmq3K0doE5kZK8faKx8X2ueWewmORv2SdwlQh6CRhvY958jIqwTIQenguLf8fsC7
- hmZb6Z8vODlaZ9h6Sh5MdkvxB0I27dnSmUV9EPKTkcT6nhUHE3awBZpvPCjPm5kKadvZpijMY
- DqKbdXFfWnr4fMG1TVJcrJxIskIIqwTUFAm9WNjuz3OLPpRq/6BrTz9xlrn7NwyZ+IZXFh3Wy
- YfR8S9XezQE6BQFOwY0bq6AvQibuwqCzqbXVZ0dbRAvzmnW3WmU/zDsStY6L5x7kxxpPJ0Zwb
- YjWQJ0H6tOFZVikIVvg5MySd+t6bu6/dE7FrYNCAjP++aNMTMyL8xW0j2iwYjB1ow9B3jF0Yc
- lUO0C/L
- Yes, I understand. The documentation mailing list is mainly for the
- documentation maintainers to dicuss improvements and issues with the
- current documentation, not for clarifications of the documentation
- contents. If the documentation is in error or unclear, filing a report
- via <https://bugs.php.net/> would be appropriate. If you're uncertain,
- just write to the general mailing list, to Usenet's comp.lang.php or any
- other support forum/channel. Usually, you get at least sufficient info
- there.
- This said, no, using traits does not conform to "favor composition over
- inheritance". Actually, traits are a limited form of multiple inheritance.
- Cheers,
- Christoph
- On 05.11.2016 at 16:21, Jeff M wrote:
- > My question is about the documentation. Specifically, my question is about
- > what you (the authors) meant when you wrote a particular phrase.
- >
- > On Sat, Nov 5, 2016 at 8:19 AM, Christoph M. Becker <cm******@gmx.de>
- > wrote:
- >
- >> On 05.11.2016 at 15:57, Jeff M wrote:
- >>
- >>> Hi, everyone. I have a question about traits and composition. On the
- >> traits
- >>> docs page <http://php.net/manual/en/language.oop5.traits.php>, it's
- >>> described as "horizontal composition of behavior". My question is, does
- >> the
- >>> word "composition" here mean the same as when the GoF said to "favor
- >>> composition over inheritance"?
- >>>
- >>> More specifically, if I have inheritance:
- >>>
- >>> class Foo { public function printItem($string) { echo 'Foo: ' .
- >> $string
- >>> ... PHP_EOL; } public function printPHP() { echo 'PHP is great.' .
- >> PHP_EOL; }
- >>> } class Bar extends Foo { public function printItem($string) { echo
- >> 'Bar: '
- >>> ... $string . PHP_EOL; } }
- >>>
- >>> And I change it to traits:
- >>>
- >>> trait Foo { public function printItem($string) { echo 'Foo: ' .
- >> $string
- >>> ... PHP_EOL; } public function printPHP() { echo 'PHP is great.' .
- >> PHP_EOL; }
- >>> } class Bar { use Foo; public function printItem($string) { echo 'Bar: '
- >> .
- >>> $string . PHP_EOL; } }
- >>>
- >>> Does that mean I'm "favoring composition"?
- >>
- >> This mailing is for discussing the PHP documentation. For support
- >> questions write to the general user list (<php-general@lists.php.net>),
- >> please.
- >>
- >> --
- >> Christoph M. Becker
- >>
- >>
- >
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement