Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[core] Documentation and cleanups for LifetimeTracker #5674

Merged

Commits on May 6, 2024

  1. [core] Doc fixes for lifetime management, minor typos.

    - Document `LifetimeTracker::triage_resources`.
    
    - Fix various typos and bad grammar.
    jimblandy committed May 6, 2024
    Configuration menu
    Copy the full SHA
    f9f9eb2 View commit details
    Browse the repository at this point in the history
  2. [core] Refactor LifetimeTracker::triage_resources.

    Check whether the resource is abandoned first, since none of the rest
    of the work is necessary otherwise.
    
    Rename `non_referenced_resources` to `last_resources`. This function
    copes with various senses in which the resource might be referenced or
    not. Instead, `last_resources` is the name of the `ActiveSubmission`
    member this may point to, which is more specific.
    
    Move the use of `last_resources` immediately after its production.
    jimblandy committed May 6, 2024
    Configuration menu
    Copy the full SHA
    04614ce View commit details
    Browse the repository at this point in the history
  3. [core] In LifetimeTrackers triage code, use more specific names.

    Rename `LifetimeTracker::triage_resources`'s `resources_map` argument
    to `suspected_resources`, since this always points to a field of
    `LifetimeTracker::suspected_resources`.
    
    In the various `triage_suspected_foo` functions, name the map
    `suspected_foos`.
    jimblandy committed May 6, 2024
    Configuration menu
    Copy the full SHA
    9ae239f View commit details
    Browse the repository at this point in the history
  4. [core] Use a for loop in LifetimeTracker triage code.

    A `for` loop is less noisy than a `drain`, which requires:
    
    - a `mut` qualifier for a variable whose modified value we never
      consult
    
    - a method name appearing mid-line instead of a control structure name
      at the front of the line
    
    - a range which is always `..`, establishing no restriction at all
    
    - a closure instead of a block
    
    Structured control flow syntax has a fine pedigree, originating in,
    among other places, Dijkstrsa's efforts at designing languages in a
    way that made it easier to formally verify programs written in
    them (see "A Discipline Of Programming"). There is nothing "more
    mathematical" about a method call that takes a closure than a `for`
    loop. Since `for_each` is useless unless the closure has side effects,
    there's nothing "more functional" about `for_each` here, either.
    Obsessive use of `for_each` suggests that the author loves Haskell
    without understanding it.
    jimblandy committed May 6, 2024
    Configuration menu
    Copy the full SHA
    ce163ef View commit details
    Browse the repository at this point in the history