simplify-names #111

Merged
glen merged 3 commits from Vectornaut/dyna3:simplify-names into main 2025-08-07 23:24:09 +00:00
Member

This pull request makes the naming changes requested in issues #109 and #110. It shouldn't affect behavior.

Notes

On the incoming branch, most methods implemented for engine::PartialMatrix use

let Self(entries) = self;

to destructure self. However, the implementation of IntoIterator for &'a PartialMatrix still uses the expression

let PartialMatrix(entries) = self;

because the Self version leads to a compiler error that says "the Self constructor can only be used with tuple or unit structs" (error code E0164). I think this is because Self is a reference type in this case. Here's a minimal working example you can play with at the Rust Playground.

struct Wrapper(i32);

trait Transform {
    fn transform(self) -> i32;
}

impl Transform for Wrapper {
    fn transform(self) -> i32 {
        let Self(inner) = self;
        10 * inner
    }
}

impl Transform for &Wrapper {
    fn transform(self) -> i32 {
        // using `Self` in place of `Wrapper` here leads to a compiler error.
        // dereferencing `self` doesn't help
        let Wrapper(inner) = self;
        100 * inner
    }
}

fn main() {
    let w = Wrapper(1);
    println!("Transformation result for each implementation");
    println!("  &Wrapper: {}", (&w).transform());
    println!("   Wrapper: {}", w.transform());
}
This pull request makes the naming changes requested in issues #109 and #110. It shouldn't affect behavior. ### Notes On the incoming branch, most methods implemented for `engine::PartialMatrix` use ```rust let Self(entries) = self; ``` to destructure `self`. However, the implementation of `IntoIterator` for `&'a PartialMatrix` still uses the expression ```rust let PartialMatrix(entries) = self; ``` because the `Self` version leads to a compiler error that says "the `Self` constructor can only be used with tuple or unit structs" (error code `E0164`). I think this is because `Self` is a reference type in this case. Here's a minimal working example you can play with at the [Rust Playground](https://play.rust-lang.org). ```rust struct Wrapper(i32); trait Transform { fn transform(self) -> i32; } impl Transform for Wrapper { fn transform(self) -> i32 { let Self(inner) = self; 10 * inner } } impl Transform for &Wrapper { fn transform(self) -> i32 { // using `Self` in place of `Wrapper` here leads to a compiler error. // dereferencing `self` doesn't help let Wrapper(inner) = self; 100 * inner } } fn main() { let w = Wrapper(1); println!("Transformation result for each implementation"); println!(" &Wrapper: {}", (&w).transform()); println!(" Wrapper: {}", w.transform()); } ```
Vectornaut added 2 commits 2025-08-05 22:05:42 +00:00
In the process, make the loader names more consistent.
Use Self in implementations whenever possible
All checks were successful
/ test (pull_request) Successful in 3m34s
1d03d1e8c2
glen reviewed 2025-08-06 15:54:11 +00:00
glen left a comment
Owner

Just a small adjustment -- if we are going to improve the names of some of the loaders by using full words, we may as well do it consistently for all of them

Just a small adjustment -- if we are going to improve the names of some of the loaders by using full words, we may as well do it consistently for all of them
@ -247,3 +247,3 @@
// C-C "
// A-C -0.25 * φ^2 = -0.6545084971874737
fn load_tridim_icosahedron_assemb(assembly: &Assembly) {
fn load_tridim_icosahedron(assembly: &Assembly) {
Owner

given the changes above, should be either load_tridiminished_icosahedron or possibly load_tridiminished.

given the changes above, should be either `load_tridiminished_icosahedron` or possibly `load_tridiminished`.
Author
Member

Done in commit 83c1823!

Done in commit 83c1823!
glen marked this conversation as resolved
@ -410,3 +410,3 @@
// to finish describing the dodecahedral circle packing, set the inversive
// distance regulators to -1. some of the regulators have already been set
fn load_dodeca_packing_assemb(assembly: &Assembly) {
fn load_dodeca_packing(assembly: &Assembly) {
Owner

Similarly, should be either load_dodecahedral_packing or load_dodecahedral or possibly load_dodecahedron.

Similarly, should be either `load_dodecahedral_packing` or `load_dodecahedral` or possibly `load_dodecahedron`.
Author
Member

Done in commit 83c1823!

Done in commit 83c1823!
glen marked this conversation as resolved
Vectornaut added 1 commit 2025-08-06 21:15:03 +00:00
Expand abbreviations in test assembly names
All checks were successful
/ test (pull_request) Successful in 3m33s
83c1823a4f
This makes the naming more consistent, and having removed the `_assemb`
suffix gives us room to expand.
glen merged commit a4565281d5 into main 2025-08-07 23:24:09 +00:00
Sign in to join this conversation.
No description provided.