Neat 0.1.0: Lambdas, IFTI, Ranges
FeepingCreature
released this
29 Dec 14:55
·
679 commits
to master
since this release
Lambdas
Lambdas are templated nested function references:
auto lambda = a -> a * 2;
IFTI
When calling a template like a function, the template
will be instantiated with the types of the arguments.
template each(Range, Callable) {
void each(Range range, Callable callable) {
for (value in range) callable(value);
}
}
...
each(2..4, a => print(a));
Ranges
Loops will now iterate over values with a fixed protocol.
for (a in range) { }
// --------------
// is the same as
// --------------
mut auto iter = range;
for (mut ElementType a = iter.front; !iter.empty; iter = iter.next) { }