[nem-en] try-catch is expression?

Kamil Skalski kamil.skalski at gmail.com
Fri Mar 23 19:01:05 CET 2007


Well, this should work. Especially that when you replace 'catch' with
just 'finally', then it is ok...
I checked it and this seems to be caused by code generated by our
yield translation, so I'm not sure if it will be possible / easy to
fix.

2007/3/23, Ivan A Eryshov <ivan.eryshov at gmail.com>:
> 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?
>
>
> _______________________________________________
> https://nemerle.org/mailman/listinfo/devel-en
>


-- 
Kamil Skalski
http://nazgul.omega.pl



More information about the devel-en mailing list