default implementation for Iterator.cancelIteration (does nothing) and not implemented errors for iterator methods (better error messages)
This commit is contained in:
parent
48a7f0839c
commit
f45310f7d9
@ -17,5 +17,26 @@
|
||||
|
||||
package net.sergeych.lyng.obj
|
||||
|
||||
val ObjIterator by lazy { ObjClass("Iterator") }
|
||||
/**
|
||||
* Iterator should provide lyng-level iterator functions:
|
||||
*
|
||||
* - hasNext()
|
||||
* - next()
|
||||
* - optional cancelIteration() that _may_ be called when iteration is performed
|
||||
* only on the part of the iterable entity. Implement it when there are resources
|
||||
* to be reclaimed on iteration interruption.
|
||||
*/
|
||||
val ObjIterator by lazy {
|
||||
ObjClass("Iterator").apply {
|
||||
addFn("cancelIteration", true) {
|
||||
ObjVoid
|
||||
}
|
||||
addFn("hasNext", true) {
|
||||
raiseNotImplemented("hasNext() is not implemented")
|
||||
}
|
||||
addFn("next", true) {
|
||||
raiseNotImplemented("next() is not implemented")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user