On Monday, 18 May 2015 at 09:12:50 UTC, Per Nordlöw wrote:
On Monday, 18 May 2015 at 08:44:30 UTC, Per Nordlöw wrote:
On Tuesday, 12 May 2015 at 00:42:28 UTC, Ali Çehreli wrote:
When will the video be available online?
A key follow-up question:
Is there any significant space- and time-overhead in being lazy
and choosing a fiber-based solution to convert a function to a
range instead of converting it to a standard D range?
One caveat with D fiber implementation is that in the following
import std.concurrency: yield;
int current = 0; // <-- Not a parameter anymore
int next = 1;
current.yield; // return
const nextNext = current + next;
current = next;
next = nextNext;
import std.concurrency: yield, Generator;
auto series = new Generator!int(&fibonacciSeries);
import std.range: take;
writefln("%(%s, %)", series.take(10));
the type of `current` and template argument to `Generator` must
manually match. Isn't it possible to design a D api that matches
these at compile-time?
Otherwise we risk getting run-time exceptions such as
yield(T) called with no active generator for the supplied type
Could yet another function qualifier (or extended attribute) do
the job of checking this at compile time?