Re: Re: async/await - is future reserved words in PHP 7.x?

From: Date: Wed, 04 May 2016 19:56:30 +0000
Subject: Re: Re: async/await - is future reserved words in PHP 7.x?
References: 1 2 3 4 5 6  Groups: php.internals 
Request: Send a blank email to internals+get-93076@lists.php.net to get a copy of this message
> I don't think we should wait, I was just thinking that it might not be ready > until that time. > > Also, if we plan on rewriting streams and I/O to all be async and use libuv > underneath, that would probably be a BC break unless the existing functions > just become blocking interfaces for a separate async API. If it was a large > BC break, it probably would need to wait for PHP 8. > > Now that I think about it, that would be our chance to replace stream > resources with classes... > > $file = \php\stream::open("file.txt"); > $bytes = await $file->read(1024); > $file->close(); > > Then rewrite fread() and friends to be aliases that block instead of await > results. This is a great opportunity to normalize API standard libraries PHP :) > $bytes = await $file->read(1024); It is rarely necessary, more often needs $result = await $db->query($sql); and $result = await $noSql->get($key);

« previous php.internals (#93076) next »