[nem-en] try-catch is expression?

Ivan A Eryshov ivan.eryshov at gmail.com
Fri Mar 23 18:27:00 CET 2007


I have a compiler error in code:
<nemerle>
using System;
using System.IO;
using System.Collections.Generic;

[Record(Include = [_fileName])]
public class FileLoader
{
    private _fileName : string;
    private mutable _proxies : list[string] = [];

    public Proxies : IEnumerable[string]
    {
      get
      {
        match (_proxies)
        {
          | [] =>
            using (sr = StreamReader(_fileName))
            {
              while (!sr.EndOfStream)
              {
                def flag = 
                  try ///////// error: try-blocks cannot be used inside
expressions, this message shouldn't happen though
                  {
                    _proxies ::= sr.ReadLine();
                    true
                  }
                  catch
                  {
                    _ is FormatException => false
                  }
                when (flag)
                  yield _proxies.Head;
              }
            }
          | _ => 
            foreach(p in _proxies.Reverse())
              yield p;
        }
      }
    }
}
</nemerle>
Is it a bug?




More information about the devel-en mailing list