The JADE 2022 release meets tomorrow’s business demands.
In the 2020 release we are introducing support for Generic Interfaces. This feature is described in JEDI Idea: JAD-I-429
The JAD-I-429 feature set includes new RootSchema interfaces such as
JadeIterableIF<T output> (equivalent to the .NET IEnumerable<T> or the Java Iterable<T> interfaces) and
JadeIteratorIF<T output> (equivalent to .NET IEnumerator<T> in .NET or the Java Enumerator<T> / Iterator<T> interfaces)
This is combined with language foreach support for iteration over any object that implements the JadeIterableIF<T> interface, allowing iteration over real or virtual collections in a type-safe manner.
A natural extension would be to provide the equivalent of an Iterator Generator that's available in languages such as C# and Python. The generator concept provides a simple and elegant means to implement a custom iterator that avoids the need for an explicit iterator class.
Proposal:
Provide the equivalent of the C# generators
yield return <expression>;
yield break;
These constructs provide a simple and elegant means to implement a custom iterator that avoids the need for an explicit iterator class.
The yield return statement is used to return each element in a sequence one at a time.
The yield break statement is used to end the iteration.
The JADE plant is interested to hear developers thoughts on whether this would be useful or not.