Wip sip23 √

End Users wouldn't be the ones creating the EC implementations,
implementors would-in essencse my proposal is to move the burden to those
who want capturing behavior (a subset of EC users).

Right now everyone pays the prepare()-tax and nobody is really benefitting
(since you say that Twitter hasn't started using it yet).
Twitter would need to create its own ECs no matter whether using prepare()
or new proposal, or?

My proposal is to make the EC spec and usage easier, based on experience in
using the current version. (Note that it is possible to nest a Capturing
within a captured or vice versa gor defaults/override behavior)

I'm very interested in seeing examples where my proposal wouldn't work, as
I don't want to make things worse than they are.
On Jun 30, 2014 8:12 PM, "marius a. eriksen" <notifications@github.com>
wrote:

> In src/library/scala/concurrent/ExecutionContext.scala:
>
> > +     *  execution context. The recommended implementation of
> > +     *  `prepare` is to return `this`.
> > +     *
> > +     *  This method should no longer be overridden or called. It was
> > +     *  originally expected that `prepare` would be called by
> > +     *  all libraries that consume ExecutionContexts, in order to
> > +     *  capture thread local context. However, this usage has proven
> > +     *  difficult to implement in practice and instead it is
> > +     *  now better to avoid using `prepare` entirely.
> > +     *
> > +     *  Instead, if an `ExecutionContext` needs to capture thread
> > +     *  local context, it should capture that context when it is
> > +     *  constructed, so that it doesn't need any additional
> > +     *  preparation later.
> > +     */
> > +  @deprecated("Preparation of ExecutionContexts will be removed.", "2.12")
>
> Right, but this is exactly my point: it's too easy to mess up; not by
> implementors, but by users. (e.g. confusing a def with a val completely
> changes semantics)
>
> Ours is baked into our Promise impl:
> https://github.com/twitter/util/blob/master/util-core/src/main/scala/com/twitter/util/Promise.scala#L162
> (We don't yet use ExecutionContexts)
>
> One way to ensure that you prepare() is to separate the types:
>
> traitExecutionContext {
>   def prepare(): Executor
> }
>
> trait Executor {
>   def execute(r: Runnable)
> }
>
> —
> Reply to this email directly or view it on GitHub
> <https://github.com/viktorklang/scala/pull/6/files#r14365577>.
>