RE: [PHP-DEV] Traits expecting interfaces implicitly leads to expensive runtime checks
| From: | Jonathan Bond-Caron | Date: | Mon, 13 Dec 2010 18:44:04 +0000 |
| Subject: | RE: [PHP-DEV] Traits expecting interfaces implicitly leads to expensive runtime checks | ||
| References: | 1 2 3 4 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-51023@lists.php.net to get a copy of this message | ||
On Sun Dec 12 04:33 PM, Nathan Nobbe wrote:
>
>
> So the 'with/within' tokens would apply to traits.
>
> I feel 'expect', 'need', 'require' etc sound better, matter of
> opinion
> really, but it sounds like from an internals perspective it's
> preferred to reuse existing keywords if possible.
>
Well my opinion is more of linguistics, given the definitions:
http://www.thefreedictionary.com/trait
http://www.thefreedictionary.com/use
http://www.thefreedictionary.com/with
Using 'with/within' keywords for a trait seem more natural and intuitive (at least as an
English speaker).
I can understand re-using existing keywords and why 'use' was ok but adding a
'require' for traits just feels awkward (saying you can 'require' code or an
interface for a trait).
I know someone's bound to say "you'll get used to it", fair enough. I'll
add that Scala also uses 'with' for traits, so it's worth considering.
>
> If you see the value in the abstract keyword in abstract classes or
> moreover interfaces in general, I'd consider the value of this feature
> equal. Of course not everyone uses abstract classes or interfaces :D
>
I agree with what you're saying, a little hesitant to say of equal value since a lot of
research has went into 'abstract' or 'interface' :)