[nem-bug] [Nemerle 0000643]: Iterator as local fanction
feedback at nemerle.org
feedback at nemerle.org
Sun Apr 2 23:27:22 CEST 2006
A NOTE has been added to this issue.
======================================================================
<http://nemerle.org/bugs/view.php?id=643>
======================================================================
Reported By: VladD2
Assigned To:
======================================================================
Project: Nemerle
Issue ID: 643
Category: Compiler
Reproducibility: always
Severity: minor
Priority: normal
Status: new
======================================================================
Date Submitted: 04-02-2006 19:16 CEST
Last Modified: 04-02-2006 23:27 CEST
======================================================================
Summary: Iterator as local fanction
Description:
If try to implement the iterator as local function:
def FromTo(from : int, to : int) : IEnumerable[int]
{
for (mutable i = from; i <= to; ++i)
yield i;
}
ngg generate this error:
error : yield used in a function returning void (it should be
System.Collections.Generic.IEnumerator[T] or
System.Collections.Generic.IEnumerable[T])
error : yield used in a function returning void (it should be
System.Collections.Generic.IEnumerator[T] or
System.Collections.Generic.IEnumerable[T])
======================================================================
----------------------------------------------------------------------
nazgul - 04-02-06 23:27
----------------------------------------------------------------------
I guess it is designed this way:
foo () : IEnumerable [int]
{
def several (x) {
yield x;
yield x + 1;
yield x + 3;
}
several (3);
seveal (100);
}
so you use local function just as an utility to make a generator from your
global function
Issue History
Date Modified Username Field Change
======================================================================
04-02-06 19:16 VladD2 New Issue
04-02-06 23:27 nazgul Note Added: 0001140
======================================================================
More information about the bugs
mailing list