#
# The module is a proof-of-concept to investigate the abuse of
# the `for` structure to implement various services.
#
# The module is a proof-of-concept to investigate the abuse of
# the `for` structure to implement various services.
# Abuser to read a file, see `file_open`
private class ReadFileForAbuser
# Abuser to read a file, see `file_open`
private class ReadFileForAbuser
var path: String
redef fun iterator do return new ReadFileForAbuserIterator(path)
end
# Abuser iterator to read a file, see `file_open`
private class ReadFileForAbuserIterator
var path: String
redef fun iterator do return new ReadFileForAbuserIterator(path)
end
# Abuser iterator to read a file, see `file_open`
private class ReadFileForAbuserIterator
private class SortAbuserIterator[E]
super Iterator[CompareQuery[E]]
# The index of the big loop
private class SortAbuserIterator[E]
super Iterator[CompareQuery[E]]
# The index of the big loop
# The array to sort
var array: Array[E]
# The query used to communicate with the user.
# For ecological concerns, a unique CompareQuery is instatiated.
# The array to sort
var array: Array[E]
# The query used to communicate with the user.
# For ecological concerns, a unique CompareQuery is instatiated.
- # 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]
# The abuse just ensures that the file is closed after the reading.
#
# for f in file_open("/etc/issue") do
# The abuse just ensures that the file is closed after the reading.
#
# for f in file_open("/etc/issue") do