[nem-en] doesn't work: using(def a = A())

Valient Gough valient at gmail.com
Mon Feb 6 04:18:51 CET 2006


If class A inherits from IDisposable, then the following would work in C#:

using(A a = new A())
{ ... }

But in Nemerle, trying this gives a compiler error:

using(def a = A())
{ ... }

test2.n:13:1:13:6: error: expected System.IDisposable, got void in
type-enforced expression: void is not a subtype of System.IDisposable
[simple require]

So it looks like ncc is treating the expression as something closer to:

mutable _tmp = null;
using(_tmp = (def a = A()) )
{ ... }

Which doesn't work..  But should it?  The C# syntax looks cleaner to me...

Val



More information about the devel-en mailing list