Hi Lukas,
Hi Jonathan:

Just a quick response on the renaming issue.

On 24 Mar 2010, at 18:04, Jonathan Bond-Caron wrote:

> On Wed Mar 24 06:50 AM, Lukas Kahwe Smith wrote:
>> The third sentence is not so clear to me, but if I guess it its also 
>> just a typo as it makes more sense to me when replacing "renaming" to 
>> "result in renaming". But maybe you could tweak that paragraph to be a 
>> bit clearer. For example its still not totally clear to me why 
>> aliasing doesn't imply inclusion, I guess its definitely more 
>> flexible.
> 
> It was really unclear to me too, this example cleared it up:
> 
> http://github.com/gron/php-src/blob/PHP_5_3-traits/Zend/tests/traits/bugs/al
> ias-semantics.phpt
> 
> The current trait implementation does not 'rename' the previous method but
> creates an 'alias'.


Yes, aliasing is kind of strange, and renaming might see more natural on first 
sight.
But, unfortunately, I do not see how that would fit with PHP.


My example why renaming is not possible is the following:

class Test {
    function foo() {
        echo "func: foo\n";
    }

    function bar() {
        echo "func: bar\n";
    }
}

$o = new Test;

$f = "foo";
$o->$f();  //this is valid PHP

$f = "bar";
$o->$f();  //this is valid PHP


So, now the only question which remains for me is, do we care?
Can we accept to break this code by introducing the notion of renaming?

What are the risks, and do the use-case for $o->$f(); matter?


I don't know. But do you use OR mappers, and if yes, how are they implemented?
It's just one possible use-case from the top of my head.

Best regards
Stefan




-- 
Stefan Marr
Software Languages Lab
Vrije Universiteit Brussel
Pleinlaan 2 / B-1050 Brussels / Belgium
http://soft.vub.ac.be/~smarr
Phone: +32 2 629 2974
Fax:   +32 2 629 3525


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

Reply via email to