On 2009-08-09 00:23:06 -0400, Bill Baxter <[email protected]> said:

Dang I remembered wrong from what I read yesterday.  C# turns it into

int get_Thing() { return _thing; }
void set_Thing(int value) { _thing = value; }

I don't recall anyone proposing exactly that for D.  There was
prop_Thing, and there was getThing.  So what C# uses is a mix of
those.

This has been proposed by Andrei at some point.

What's different in C# from the get/set_thing proposal (well, not 100% sure but almost) is that the compiler doesn't infer the property from the presence of a getter or setter with the right name, you must explcitly tell it there's a property for a given name. I'd be equivalent to:

        int get_Thing();
        void set_Thing(int);

        property Thing (getter: get_Thing; setter: set_Thing);

where "property thing" reserves the symbol "thing" for a property with the given getter/setter. (Turns out that this example is pretty much how properties are defined in Objective-C.)


--
Michel Fortin
[email protected]
http://michelf.com/

Reply via email to