Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:4107 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 51842 invoked from network); 20 Aug 2003 09:03:15 -0000 Received: from unknown (HELO mail.zend.com) (192.117.235.230) by pb1.pair.com with SMTP; 20 Aug 2003 09:03:15 -0000 Received: (qmail 11344 invoked from network); 20 Aug 2003 09:03:12 -0000 Received: from localhost (HELO zeev-laptop.zend.com) (127.0.0.1) by localhost with SMTP; 20 Aug 2003 09:03:12 -0000 Reply-To: zeev@zend.com Message-ID: <5.1.0.14.2.20030820120132.091a4328@localhost> X-Sender: zeev@localhost X-Mailer: QUALCOMM Windows Eudora Version 5.1 Date: Wed, 20 Aug 2003 12:03:18 +0300 To: Vesselin Atanasov Cc: internals@lists.php.net In-Reply-To: <759160955.1061370003578.JavaMail.nobody@app1.ni.bg> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Subject: Re: Re: [PHP-DEV] __autocreate() function for non-existing variables From: zeev@zend.com (Zeev Suraski) References: <759160955.1061370003578.JavaMail.nobody@app1.ni.bg> Try to use the language features that exist to implement your functionality. If you find that you cannot do it, chances are that you're trying to do something wrong, and not that the language is missing some core feature. Zeev At 12:00 20/08/2003, Vesselin Atanasov wrote: >Hello. >Sorry for double posting but I forgot to CC it to the mailing list. > >Basically I need some special names to be available automatically >without the need to create them via new() >Some of them just like the database object will be singletons, >but some need a different copy in every symbol table in which >they are used. Basically a singleton + automatic visibility is an >autoglobal variable, but a non-singleton + automatic visibility >cannot be implemented without adding some functionality to the Zend engine. > >vesselin > > > > >I don't see need for this magic. You can implement this using a simple > >singleton pattern, if you need it. I don't think we want to add features > >that will condone the use of globals, a singleton class is a much better > >solution for that. > > > >Zeev > > > >At 06:10 20/08/2003, Vesselin Atanasov wrote: > >>Hello. > >>I think that it would be useful to allow an __autocreate() function create > >>non-existing > >>variables just like __autoload is called for non-existing classes. The > >>function will be > >>called when an attempt is made to read a non-existent variable. It will > >>return a reference > >>to the new variable it creates. This could be very useful in some > cases. For > >>example it > >>could be used in a php library that creates a database object. When some > >>function tries to > >>use the database object, the __autocreate function will check if a global > >>database object > >>exists. If it does not exist the function will create the database > object as > >>global and > >>in either case return a reference to the object. > >> > >>I am willing to implement this functionality, but I'd like to hear the > >>opinion of the PHP > >>developers first and especially of the Zend2 team because this > functionality > >>will modify > >>the Zend2 engine. > >> > >>vesselin > >> > >> > >>-- > >>PHP Internals - PHP Runtime Development Mailing List > >>To unsubscribe, visit: http://www.php.net/unsub.php > > > >