class Scope {

	public synchronized final void link(Scope<T> scope)
			throws CyclicScopeLinkageException {
		Ensure.not_null(scope);
		Ensure.is_false(m_linked.contains(scope));
		
		/*
		 * Make sure there are no cyclic dependencies.
		 */
		Set<Scope<T>> current = new HashSet<>();
		current.addAll(m_linked);
		current.add(scope);
		Set<Scope<T>> seen = new HashSet<>(current);
		
		do {
			current = follow_set(current);
			if (current.contains(this)) {
				throw new CyclicScopeLinkageException("Scope '" + m_name
						+ "' would be in a cyclic linkage graph if linked "
						+ "with scope '" + scope.m_name + "'.");
			}
			
			current.removeAll(seen);
			seen.addAll(current);
		} while (current.size() > 0);
		
		/*
		 * If we've reached here then there is no problem in linking the
		 * given scope.
		 */
		check_link(scope);
		
		m_linked.add(scope);
	}

	public  Scope(String name);

}