[nem-en] accessor macro question
Kamil Skalski
kamil.skalski at gmail.com
Sat May 27 09:32:52 CEST 2006
When I compile and dissasemble this program I get:
.class public auto ansi Foo
extends [mscorlib]System.Object
{
.field private string _bar
.method public hidebysig specialname rtspecialname
instance void .ctor() cil managed
{
// Code size 7 (0x7)
.maxstack 2
IL_0000: ldarg.0
IL_0001: call instance void [mscorlib]System.Object::.ctor()
IL_0006: ret
} // end of method Foo::.ctor
.method public hidebysig specialname instance string
get_Bar() cil managed
{
// Code size 7 (0x7)
.maxstack 1
IL_0000: ldarg.0
IL_0001: ldfld string Foo::_bar
IL_0006: ret
} // end of method Foo::get_Bar
.method public hidebysig specialname instance void
set_Bar(string 'value') cil managed
{
// Code size 8 (0x8)
.maxstack 2
IL_0000: ldarg.0
IL_0001: ldarg.1
IL_0002: stfld string Foo::_bar
IL_0007: ret
} // end of method Foo::set_Bar
.property string Bar(string)
{
.get instance string Foo::get_Bar()
.set instance void Foo::set_Bar(string)
} // end of property Foo::Bar
} // end of class Foo
I'm not sure how did you get the code you mentioned, but it must be
some mistake...
2006/5/27, mei <mei at work.email.ne.jp>:
> Hi,
>
> I want to know about accessor macro.
>
> -- sample.n
> using System;
> using System.IO;
> using Nemerle.Utility;
>
> public class Foo {
> [Accessor(flags=WantSetter)] mutable _bar : string;
> }
> --
>
> compiled sample.n to dll(assembly) and use from C#.
> but error CS1545 occurred.
>
> then, I disassemble the compiled asseimbly by Reflector.
>
> --
> public class Foo
> {
> // Methods
> public Foo();
>
> // Properties
> public string this[string] { get; set; }
>
> // Fields
> private string _bar;
> }
> --
> there is indexer, but Bar property is not exists.
>
> Please give me instructions for using the accessor macro.
>
>
> Thanks.
>
> --
> akiramei <mei at work.email.ne.jp>
>
> _______________________________________________
> https://nemerle.org/mailman/listinfo/devel-en
>
--
Kamil Skalski
http://nazgul.omega.pl
More information about the devel-en
mailing list