Marcus Boerger wrote:
> Hello Lukas,
> 
>   alright,
> 
>    'foo as bar' is ok to me and does not even add a new keyword.
> Ignore or any more keywords are bad and I also think that the correct
> would be hide(ing). But as I further more explained it should really be
> something that only marks a method as private if at all. That can be
> done as:
>    'foo as private' since private is a keyword it cannot conflice anyway.

I like this solution.

I have been uncomfortable with the current trait suggestions because
they occur in the body of the class, whereas extends/implements is
outside.  I think there is a way to handle this, however.

class Blah extends ... implements ... traits trait1, trait2, trait3 {
}

The above presents a problem if trait2 contains conflicting method
names, but a simple way to solve it would be to automatically alias
methods by prepending traitname::

<?php

trait trait1 { function a(){}}
trait trait2 { function a(){}}
class Blah extends ... implements ... traits trait1, trait2, trait3 {
}
?>

would create method "trait2::a" and we can alias it in the class body.

Also, $a->{'trait2::a'}(); is legal syntax, so no problems there.


Example:

<?php

trait trait1 { function a(){}}
trait trait2 { function a(){}}
class Blah extends ... implements ... traits trait1, trait2, trait3 {
    function trait2::a as b;
}
?>

This would be 100% obvious to me, and far clearer for reading since we
would be explicitly saying we're aliasing a function.

So, I rescind my previous syntax suggestion in favor of the above.

Greg

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to