2015-02-01 2:23 GMT+02:00 Stanislav Malyshev <smalys...@gmail.com>:
> Hi!
>
>> If  the caller explicitly send the object as an argument, it worsens
>> loose depending API.
>>
>> And agreed this code looks weird and not well thought-out:
>> <?php
>>
>> $holder->object->call($holder);
>
> This code explicitly says "object->call() is using $holder". It is clear
> and unambiguous. If you did it implicitly - i.e. wrote
> $holder->object->call() and that used $holder under the hood in call() -
> then you could have modified or even completely destroyed $holder under
> the assumption that nobody depends on it, but in fact whatever is in
> $holder->object, unknown to you, would depend on it and would break.
> Such hidden dependencies are not a good design.
>
>> But if have an easy way to get a pointer to the owner, in practice, is
>> very convenient.
>
> It may be convenient in short run, but I think in the long run creating
> hidden dependencies would make code less robust so it is better not to
> enable it as a best practice.
> --
> Stas Malyshev
> smalys...@gmail.com

Everything is relative, when there is an experience in a dynamic
context (this) in JS, while unwieldy structure in PHP code look
something old and not comfortable.

I think, that purchased experience will be the use of safety culture
dynamic runtime context, many developers it would be appreciated, to
implement this PHP frameworks.

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

Reply via email to