Generators in D

Piotr Szturmaj bncrbme at jadamspam.pl
Wed May 11 15:10:49 PDT 2011


KennyTM~ wrote:
> On May 11, 11 08:06, Piotr Szturmaj wrote:
>> I forgot to ask. Any comments or suggestions?
>
> The argument match assertion is too strict. The following does not compile:
>
> ---------------
> void main() {
> auto a = generator( (out int result, double e) {
> yield!result(1);
> }, 4);
> writeln(a);
> }
> ---------------
> x.d(40): Error: static assert "Arguments do not match"
> x.d(104): instantiated from here: _generator!(void delegate(out int
> result, double e),int)
> x.d(108): instantiated from here: generator!(void delegate(out int
> result, double e),int)
> ---------------
>
> Perhaps you could just remove the assert? The compiler will complain if
> the arguments cannot be accepted anyway.
>

You're right, it's better without that assert. Fixed.


More information about the Digitalmars-d mailing list