Re: Simple variable handling.
| From: | Rowan Collins | Date: | Fri, 12 Aug 2016 10:13:57 +0000 |
| Subject: | Re: Simple variable handling. | ||
| References: | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-95082@lists.php.net to get a copy of this message | ||
On 12/08/2016 10:52, Lester Caine wrote:
I think the idea *I* am throwing out for discussion is a switch from global_library($var, ... ) to $var->global_library( ... ) where $var is now always an object without having every framework creating it's own version of the wrapper?So kind of an extension to the "scalar objects" idea (e.g. https://github.com/nikic/scalar_objects) such that variables can have arbitrary properties / state rather than just the syntax sugar of ->methodCall() ? One problem I can see is that like with references and objects, the meaning of assignment has to change somehow: $foo = 'hello world'; $foo->setReadonly(); var_dump($foo->isReadonly()); // TRUE $bar = $foo; var_dump($bar->isReadonly()); // ? same value, different variable $foo = 'goodbye world'; var_dump($foo->isReadonly()); // ? same variable, different value Of course, the same applies whenever you pass the variable into a function, or return it from one... Regards, -- Rowan Collins [IMSoP]