pike.git / lib / modules / Concurrent.pmod

version» Context lines:

pike.git/lib/modules/Concurrent.pmod:338:       //! @returns    //! A @[Future] that will be fulfilled with an    //! array of the fulfilled result of this object followed    //! by the fulfilled results of @[others].    //!    //! @seealso    //! @[results()]    this_program zip(this_program ... others)    { -  return sizeof(others) -  ? results(({ this_program::this }) + others) -  : this_program::this; +  if (sizeof(others)) +  return results(({ this_program::this }) + others); +  return this_program::this;    }       //! JavaScript Promise API close but not identical equivalent    //! of a combined @[transform()] and @[transform_with()].    //!    //! @param onfulfilled    //! Function to be called on fulfillment. The first argument will be the    //! result of @b{this@} @[Future].    //! The return value will be the result of the new @[Future].    //! If the return value already is a @[Future], pass it as-is.
pike.git/lib/modules/Concurrent.pmod:965:   //! has @[on_failure] and @[on_success] methods, return it unchanged.   //!   //! @note   //! This function can be used to ensure values are futures.   //!   //! @seealso   //! @[Future.on_success()], @[Promise.success()]   //! @url{https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Promise@}   Future resolve(mixed value)   { -  return objectp(value) && value->on_failure && value->on_success -  ? value -  : Promise()->success(value)->future(); +  if (objectp(value) && value->on_failure && value->on_success) +  return value; +  return Promise()->success(value)->future();   }      //! Return a @[Future] that represents the array of mapping @[fun]   //! over the results of the completed @[futures].   Future traverse(array(Future) futures,    function(mixed, mixed ... : mixed) fun,    mixed ... extra)   {    return results(futures->map(fun, @extra));   }