Icicle v0.9.0 Release Notes
Release Date: 2015-12-02 // over 8 years ago-
๐ Changes
- ๐ All interface names have been changed to remove the
Interface
suffix. Most interfaces simply had the suffix removed, but there are a few exceptions - more below. - Promises are now Awaitables
- The
Icicle\Promise
namespace has been renamed toIcicle\Awaitable
.Icicle\Promise\PromiseInterface
is nowIcicle\Awaitable\Awaitable
. Icicle\Awaitable\Promise
(previouslyIcicle\Promise\Promise
) now extends a new classIcicle\Awaitable\Future
that implementsIcicle\Awaitable\Awaitable
.Future
uses protected methods to resolve the awaitable, so it can be extended to create awaitables that are resolved in different ways. The functionality ofPromise
has not changed.Icicle\Coroutine\Coroutine
now also extendsIcicle\Awaitable\Future
. The functionality ofCoroutine
has not changed, but it should be faster to create aCoroutine
object.Icicle\Coroutine\CoroutineInterface
has been removed.
- The
- ๐ The
Icicle\Loop\Events
namespace was renamed toIcicle\Loop\Watcher
. Interfaces in the namespace were removed exceptEventInterface
which was renamed toWatcher
. Icicle\Loop\Events\SocketEvent
was renamed toIcicle\Loop\Watcher\Io
since more than just 'sockets' can be used.Icicle\Coroutine\create()
no longer throws if the callback throws or returns a promise, instead it returns a rejected coroutine.- โฑ
Icicle\Awaitable\Awaitable::timeout()
(previouslyIcicle\Promise\PromiseInterface::timeout()
) now takes a callback function that is invoked if the parent awaitable is not resolved in the given timeout. The promise returned from this method is resolved by the callback function. This callback function can still cancel the parent promise if desired or perform any other action. - ๐ป Rejecting an awaitable now requires an exception instance.
- ๐ป
Icicle\Awaitable\Awaitable::cancel()
(previouslyIcicle\Promise\PromiseInterface::cancel()
now requires an exception instance or null. If null, an instance ofIcicle\Awaitable\Exception\CancelledException
is used. - ๐ป
Icicle\Awaitable\Awaitable::timeout()
(previouslyIcicle\Promise\PromiseInterface::timeout()
now takes a callable or null as the second argument. The awaitable returned fromtimeout()
is resolved by the callable or rejected with an instance ofIcicle\Awaitable\Exception\TimeoutException
if no callable is given.
๐ New Features
- โ Added observables that represent asynchronous collections. Observables implement
Icicle\Observable\Observable
and include array-like methods includingObservable::map()
andObservable::filter()
. Observables can be iterated over asynchronously in a coroutine using the iterator returned fromObservable::getIterator()
. See the example inexamples/observable.php
and the documentation (work-in-progress) for more information. Icicle\Awaitable\Delayed
was added as a publicly resolvable awaitable. This type of awaitable should not be returned from public APIs, but rather only used internally within a class or Coroutine to create an awaitable that can be resolved later. So in other words, a class method or function should never return aDelayed
. In general, methods and functions should not be returning awaitables as part of their public API. The public API should consist of Generators that can be used as Coroutines.Icicle\Awaitable\Awaitable
now has a methoduncancellable()
that returns an awaitable that cannot be cancelled (thecancel()
method is a no-op).
- ๐ All interface names have been changed to remove the