How to install the latest version of the compiler from source?
See here:
http://cobra-language.com/trac/cobra/wiki/HowToInstallFromSource@ OurousYes, the latest changeset (
http://cobra-language.com/trac/cobra/changeset/3119)
does "fix" something:
- now the
print statement can print an iterator that produces 1 element,
even if both, the iterator and the
print statement, use the same instance of
PrintStringMaker.
But what happens when the iterator produces more than 1 element?
Look at this example:
class Demo
def m1 as String*
"""
This is the iterator of the testcase, which was added to Cobra svn:3119.
It "enumerates" 1 item only.
"""
yield ['a', 'b', 'c'].join('')
def m3 as String*
"""
This is the same iterator, but it produces 3 items, instead of 1 only.
"""
yield ['a', 'b', 'c'].join('')
yield ['a', 'b', 'c'].join('')
yield ['a', 'b', 'c'].join('')
def main
print .m1
print .m3
The expected/correct output of
print .m3 is:
-
['abc', 'abc', 'abc'] The actual output is
- in Cobra svn:3118:
[''a''b''c'', ''a''b''c'', ''a''b''c''] -- all items wrong
- in Cobra svn:3119:
['abc', ''a''b''c'', ''a''b''c''] -- the first item is correct!
Ourous, you are right, it is the `_level` in `StringMaker.enumerableToString`:
it must be 0 when the `IEnumerator.moveNext` method of the iterator is executed -- but always, not just for the first item.