abstract_compiler: remove -lunwind if target is Darwin (macosx)
[nit.git] / lib / for_abuse.nit
index 9ecaf63..40cb1bf 100644 (file)
@@ -25,13 +25,15 @@ 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
 end
 
 # Abuser to read a file, see `file_open`
@@ -139,8 +141,8 @@ redef class Array[E]
        # The user uses the provided query (item) to implements its own comparison
        #
        #     var a = [1, 3, 2]
-       #     for q in a do q.res = q.a <=> q.b
-       #     assert print a      ==  123
+       #     for q in a.sort_fa do q.res = q.a <=> q.b
+       #     assert a ==  [1, 2, 3]
        #
        # Implements a sort by permutation.
        fun sort_fa: ForAbuser[CompareQuery[E]]
@@ -155,7 +157,9 @@ end
 # The abuse just ensures that the file is closed after the reading.
 #
 #     for f in file_open("/etc/issue") do
-#       print f.read_line
+#         var l = f.read_line
+#         print l
+#         assert not l.is_empty
 #     end # f is automatically closed here
 fun file_open(path: String): ForAbuser[IFStream]
 do