You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I propose we remove the get_ prefix on most getters in the codebase.
If the glorious leaders of Servo approve this, I (@frewsxcv) would be willing to take on this momentous feat.
RFC
A method foo(&self) -> &T for getting the current value of the field.
A method set_foo(&self, val: T) for setting the field. (The val argument here may take &T or some other type, depending on the context.)
Within the DOM we do this already, but somehow all unsafe layouty methods and bindings still have this.
Avoid touching script/ until the SM upgrade passes.
Servo and Rust don't really follow the style for Rust-y code in their internals (partially because they've been around for very long and fixing style to fix the fluid "prevailing" style is very low priority), but that doesn't mean we shouldn't try.
Actually, come to think of it I prefer having get_ on unsafe methods (very common in layout <-> DOM). When calling unsafe methods you should know what's happening, and get_ emphasizes that it's just a getter (and you know what invariants must be satisfied for the usage to be safe)
Actually, come to think of it I prefer having get_ on unsafe methods
Just to be absolutely clear, do you believe that none of the APIs should change or should I just avoid the unsafe ones (in addition to the script/ ones)
Just avoid the unsafe ones and the script ones (unless pcwalton or someone else who uses them regularly is okay with it). Most of the unsafe ones are in script anyway.
Activity
Manishearth commentedon May 31, 2015
+1
Within the DOM we do this already, but somehow all unsafe layouty methods and bindings still have this.
Avoid touching
script/until the SM upgrade passes.Servo and Rust don't really follow the style for Rust-y code in their internals (partially because they've been around for very long and fixing style to fix the fluid "prevailing" style is very low priority), but that doesn't mean we shouldn't try.
Manishearth commentedon May 31, 2015
Actually, come to think of it I prefer having
get_onunsafemethods (very common in layout <-> DOM). When calling unsafe methods you should know what's happening, andget_emphasizes that it's just a getter (and you know what invariants must be satisfied for the usage to be safe)frewsxcv commentedon May 31, 2015
Just to be absolutely clear, do you believe that none of the APIs should change or should I just avoid the unsafe ones (in addition to the
script/ones)Manishearth commentedon May 31, 2015
Just avoid the unsafe ones and the script ones (unless pcwalton or someone else who uses them regularly is okay with it). Most of the unsafe ones are in script anyway.
Remove `get_` prefix on getters
Remove `get_` prefix on getters
Auto merge of #6230 - frewsxcv:getters-get, r=nox
nox commentedon Jun 2, 2015
Never mind.
Auto merge of #7559 - ddrmanxbxfr:RFC-0344-Work, r=nox
Auto merge of #7559 - ddrmanxbxfr:RFC-0344-Work, r=nox
Auto merge of #7559 - ddrmanxbxfr:RFC-0344-Work, r=nox
frewsxcv commentedon Sep 13, 2015
I'm pretty satisfied with the work that's been done towards this. There might be a few remaining but it's probably not worth it to keep this open
Remove `get_*` on getters as per RFC 0344.
Auto merge of #10327 - frewsxcv:get-prefix, r=ms2ger
Remove `get_*` on getter as per RFC 0344.
Remove `get_*` on getters as per RFC 0344.
servo: Merge #10327 - Remove `get_*` on getters as per RFC 0344 (from…
servo: Merge #10327 - Remove `get_*` on getters as per RFC 0344 (from…
servo: Merge #10327 - Remove `get_*` on getters as per RFC 0344 (from…
servo: Merge #10327 - Remove `get_*` on getters as per RFC 0344 (from…