public <T> Provider<T> scope(final Key<T> key, final Provider<T> unscoped) {

        // Memoize call to unscoped.get() under key.

        return new Provider<T>() {
            public T get() {
                ConcurrentMap<Key<T>, Future<T>> futures = futures();
                Future<T> f = futures.get(key);
                if (f == null) {
                    FutureTask<T> creator = new FutureTask<T>(new Callable<T>() {
                        public T call() {
                            return unscoped.get();
                        }
                    });
                    f = futures.putIfAbsent(key, creator);
                    if (f == null) {
                        f = creator;
                        creator.run();
                    }
                }
                try {
                    return f.get();
                } catch (ExecutionException e) {
                    Throwable t = e.getCause();
                    if (t instanceof Error) {
                        throw (Error) t;
                    }
                    // Can't be a checked exception, so we cast.
                    throw (RuntimeException) e.getCause();
                } catch (InterruptedException e) {
                    Thread.currentThread().interrupt();
                    throw new ProvisionException("interrupted during provision", e);
                }
            }
        };
    }