[nem-en] Declaring Properties in the constructor - ala Boo
vc
vc at rsdn.ru
Fri Sep 29 17:30:15 CEST 2006
> class SomeClass
> {
> [Accessor(AnInt, flags=WantSetter)]
> private mutable _an_int : int;
>
> [Accessor(AString, flags=WantSetter)]
> private mutable _a_string : string;
>
>
> public this(i : int) {
> AnInt = i;
> }
> }
>
> sc = SomeClass(3, AString: "hello");
Nemerle already support this:
using Nemerle.Utility;
public class A
{
public this(test : string)
{
_test = test;
}
[Accessor] _test : string;
}
def a = A(test = "test");
_ = a;
And mach more! :)
using Nemerle.Utility;
[Record]
public class A
{
[Accessor] test : string;
}
def a = A(test = "test");
_ = a;
More information about the devel-en
mailing list