1
0
mirror of https://github.com/danog/amp.git synced 2024-11-27 12:35:02 +01:00
Commit Graph

59 Commits

Author SHA1 Message Date
Daniel Lowrey
1a891f54ac Remove streamable support in coroutine resolution 2015-06-15 13:17:27 -04:00
Daniel Lowrey
57c0f222ea Support extended generator error debugging output in PHP7 2015-06-15 11:56:42 -04:00
Daniel Lowrey
deedb4a7fa minor coroutine optimization to avoid extra valid() fcall 2015-06-15 10:58:24 -04:00
Bob Weinand
298357f760 We need to check for Generator::getReturn() in ≥ PHP 7 2015-06-13 18:37:04 +02:00
Daniel Lowrey
f2a0488d87 Add Amp\promises() to coalesce values/promises/promisors to promises 2015-06-09 11:49:22 -04:00
Daniel Lowrey
e923ea3fde minor timeout function/test cleanup 2015-05-31 20:18:42 -04:00
Daniel Lowrey
34088cbf52 Add timeout() function 2015-05-31 20:13:39 -04:00
Daniel Lowrey
0c4f04c6ab Fix missing parameter if coroutine invoked without args 2015-05-27 18:33:57 -04:00
Bob Weinand
6c440b2797 Fix fatal error upon wrong key type 2015-05-27 23:36:22 +02:00
Daniel Lowrey
5e7d6ff095 Fix coroutine fatal if initial advance errored 2015-05-25 12:51:50 -04:00
Daniel Lowrey
e8ac57db31 make function name consistent with others 2015-05-20 20:09:30 -04:00
Daniel Lowrey
29cde175b3 Minor coroutine resolution updates 2015-05-20 19:51:03 -04:00
Daniel Lowrey
c86d6cc930 don't swallow caught exception 2015-05-20 18:29:45 -04:00
Daniel Lowrey
0255049bbb Don't use php7 ReflectionGenerator in PHP5.x branch 2015-05-20 18:19:23 -04:00
Daniel Lowrey
e6f1386b31 Fix double promisor resolve under error condition 2015-05-20 18:16:42 -04:00
Daniel Lowrey
71f9687cff Reactor watcher option "callback_data" renamed "cb_data" 2015-05-20 15:21:59 -04:00
Daniel Lowrey
c7e4e8d0c3 Miscellaneous function changes (more after jump)
- Combinator functions optimized for performance
- Amp\reactor() now accepts an optional assignment parameter for
  modifying the global default event reactor instance to allow for
  third-party Reactor implementations.
- Renamed functions:
    . Amp\getReactor() -> Amp\reactor()
- Removed functions:
    . Amp\chooseReactor()
    . Amp\tick()
    . Amp\immediately()
    . Amp\once()
    . Amp\repeat()
    . Amp\onReadable()
    . Amp\onWritable()
    . Amp\onSignal()
    . Amp\enable()
    . Amp\disable()
    . Amp\cancel()
2015-05-20 15:18:30 -04:00
Daniel Lowrey
9fa6010f19 Optimize non-promise pipe() case 2015-05-19 23:12:32 -04:00
Daniel Lowrey
c8d6a0b5b3 Optimize coroutine resolution for performance 2015-05-19 23:07:29 -04:00
Daniel Lowrey
e3e01c993c Add Amp\Streamable interface for buffered generator resolution 2015-05-19 12:03:26 -04:00
Daniel Lowrey
2a0486cb3c Add Amp\pipe() function to pipe eventual results through a functor 2015-05-19 11:31:01 -04:00
Daniel Lowrey
1ed5e69c52 Move buffering to PromiseStream for custom behavior in extended instances 2015-05-19 01:09:23 -04:00
Daniel Lowrey
953c4612e6 Future -> Deferred 2015-05-19 00:21:33 -04:00
Daniel Lowrey
3af013d418 Expose boolean AMP_DEBUG for performance tuning
Amp Future instances double both as Promisor and Promise
implementations when AMP_DEBUG is defined and set to false.
This switch allows private Promise resolution safety by
default at the expense of performance.

Amp applications should set AMP_DEBUG to false in production
environments to maximize performance.
2015-05-18 23:57:34 -04:00
Daniel Lowrey
0973bba5ef Add PromiseStream to stream Promise updates without callback hell 2015-05-18 17:39:09 -04:00
Daniel Lowrey
631a6089d9 Resolve correct Success arg in empty any\(\) combinator 2015-05-15 15:59:57 -04:00
Daniel Lowrey
2c3a3e65bd Add offending generator key to coroutine resolution error messages 2015-05-13 01:15:35 -04:00
Daniel Lowrey
cddb8e9f08 Backport API changes to 5.5+ compat 2015-05-04 12:48:29 -04:00
Daniel Lowrey
b9819d85b4 kill reference to removed function 2015-04-29 13:45:06 -04:00
Daniel Lowrey
1565e23d46 replace call_user_func() reference 2015-04-27 14:33:41 -04:00
Daniel Lowrey
7cb09edf29 Use anonymous classes 2015-04-27 14:33:17 -04:00
Daniel Lowrey
446eded441 Remove superfluous parameter 2015-04-27 14:30:07 -04:00
Daniel Lowrey
812e1fb6b4 Reactor API updates, NativeReactor refactor 2015-04-03 11:56:16 -04:00
Daniel Lowrey
b57f6eb6bf Add explanatory comment 2015-03-28 10:05:09 -04:00
Daniel Lowrey
fa080b66aa Remove superfluous is_object() check 2015-03-28 10:03:27 -04:00
Daniel Lowrey
9a1581c91d Bind local vars to closure 2015-03-25 14:17:26 -04:00
Daniel Lowrey
af2335cf50 Remove deprecated wait functionality 2015-03-19 11:17:50 -04:00
Daniel Lowrey
16be668192 Add scalar types, update docblocks 2015-03-19 11:15:07 -04:00
Daniel Lowrey
834255163c Refactor coroutine functionality 2015-03-16 15:00:17 -04:00
Grégoire Pineau
01d50d10f9 Fixex typos 2015-02-05 18:17:05 +01:00
Daniel Lowrey
99e38762a7 - Added Reactor::coroutine() method
- Added `Amp\coroutine()` function
- `YieldCommands` "enum" constant class removed -- yield keys now live in
  the reactor class
- New optional `"coroutine"` yield key for self-documenting generator
  yields.
- New optional `"async"` yield key for self-documenting promise yields.
- New `"return"` yield key for specifying the return value of a resolved
  Generator coroutine. If not specified a resolved coroutine result is
  equal to null.
- The final value yielded by a resolved `Generator` is *no longer* used
  as its "return" value. Instead, generators must manually use the new
  `"return"` yield key specifically to designate the value that should
  be used to resolve the promise associated with generator resolution.
- `GeneratorResolver` trait renamed to `CoroutineResolver` and is now an
  abstract class extended by the various `Reactor` implementations.
- Implicit "all" array combinator resolution is now removed. Use the
  explicit form instead:

```php
function() {
    list($a, $b, $c) = (yield 'all' => [$promise1, $promise2, $promise3]);
};
```
2015-02-03 19:41:15 -05:00
Daniel Lowrey
b11e7a0fd1 Fix combinator function derps (again) 2014-12-04 18:08:13 -05:00
Daniel Lowrey
a8fe6e2e39 Fix combinator function derps 2014-12-04 13:34:42 -05:00
Daniel Lowrey
f32d088c23 Lots of changes ... see CHANGELOG for details 2014-12-01 19:45:57 -05:00
Daniel Lowrey
c75a8514a1 Reactor is now optional for combinator functions 2014-11-25 12:46:29 -05:00
Daniel Lowrey
1cb293b776 Remove Combinator/Resolver in favor of functions
This commit removes the Combinator and Resolver classes altogether.
The relevant functionality is now concentrated entirely in the
analogous functions:

- all()
- some()
- any()
- first()
- map()
- filter()
- resolve()

Additionally, all Promisor implementations now *require* a Reactor
upon instantiation. Previously this parameter could be null and the
static singleton reactor instance would be used automatically.
2014-11-24 23:14:07 -05:00
Daniel Lowrey
c28e143828 Remove watchStream() ... aliases are bad 2014-11-05 11:50:46 -05:00
Daniel Lowrey
70222364d5 Use singleton reactor instance in functions 2014-11-04 09:46:12 -05:00
Daniel Lowrey
7b11a8e0c3 Rename any() -> some(), change any() to never fail 2014-10-22 18:14:43 -04:00
Andrey Janzen
27a0b8ff2c add missed $func passing in map() & filter() 2014-10-15 18:07:35 +04:00