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

Piotr Kalinowski pitkali at gmail.com
Mon Feb 6 07:50:38 CET 2006


On 06/02/06, Valient Gough <valient at gmail.com> wrote:
> 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]

It's because in Nemerle, unlike in C#, assignment does not return
assigned value. So the type of any assignment is void.

Best Regards,
--
Intelligence is like a river: the deeper it is, the less noise it makes



More information about the devel-en mailing list