deferred class STREAM [G]

inherit
	INTERNAL

feature 

	item: G is
		deferred
		end;

	tail: STREAM [G] is
		deferred
		end;

	last: BOOLEAN is
		deferred
		end;

	show (n: INTEGER) is
		local
			i: INTEGER;
			s: STREAM [G]
		do
			from
				i := 1;
				s := Current
			until
				i > n or s = void
			loop
				if i > 1 then
					io.putstring (", ")
				end;
				io.putstring (pad (s.item.out));
				s := s.tail;
				i := i + 1
			end;
			if s = void then
				io.putchar ('.')
			else
				io.putstring ("...")
			end;
			io.new_line
		end;

	pad (s: STRING): STRING is
			-- would like to do that with Eiffel lib
		do
			if s.count < 2 then
				s.prepend (" ")
			end;
			Result := s
		end;
	
feature {STREAM} 

	isnotsuspended: BOOLEAN is
		deferred
		end;

	tovalue: STREAMVAL [G] is
		deferred
		end;
	
feature {STREAMTAIL} 

	forcedtail: STREAM [G] is
		deferred
		end;
	
end -- class STREAM