Want: proc macro to add getter / setter properties to fields. #[derive(Access)] pub struct Foo { #[access(get, get_mut, set)] bar: bool, } let mut foo = Foo::default(); http://foo.bar (); // false foo.set_bar(true); http://foo.bar (); // true
I doubt performance would be an issue here tbh — zero cost abstractions and all, haha.
The difference here, I think, is that I'm trying to enforce a contract when defining a function, rather than using COW / mut at usage time. That way usage becomes less easy to mess up 
-
-
There's some pushback against get/set for the reason that Java is the dominant language using that pattern alone. :/
-
I think those few times where it's justified you can write those by hand. Java of course being the example where get/set was being used excessivly

- 1 more reply
New conversation -
Loading seems to be taking a while.
Twitter may be over capacity or experiencing a momentary hiccup. Try again or visit Twitter Status for more information.