From c25debfc83a57da2b84dcff19d7217d8b809bc37 Mon Sep 17 00:00:00 2001 From: Jean Privat Date: Fri, 25 Oct 2013 10:48:13 -0400 Subject: [PATCH] lib: detach ForAbuser from Collection Since it is no more a requirement. Signed-off-by: Jean Privat --- lib/for_abuse.nit | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) diff --git a/lib/for_abuse.nit b/lib/for_abuse.nit index 9ecaf63..ab469a6 100644 --- a/lib/for_abuse.nit +++ b/lib/for_abuse.nit @@ -25,13 +25,26 @@ module for_abuse # The service is not effectively started until the iterate method # is called. Then, each step of the iteration is a step in the service. # -# While, for a typing point of view, abusers are just collections, -# the point of this class is to tag services that return a ForAbuser -# object. -# Note that using abuser as genuine collection should work but is not -# recommended since it may cause mental health issues. +# While, for a typing point of view, abusers are just classes with an +# iterator method, the point of this class is to tag services that return +# a ForAbuser object. +# +# Note that using having `ForAbuser` as a genuine subclass of `Collection` +# works but is not recommended since it may cause mental health issues. interface ForAbuser[E] - super Collection[E] + # Starts and control the service + fun iterator: Iterator[E] is abstract + + # Starts and contol the service (for `nitc`) + fun iterate + !each(e: E) + do + var i = iterator + while i.is_ok do + each(i.item) + i.next + end + end end # Abuser to read a file, see `file_open` -- 1.7.9.5