Skip to content

First Example does not match to the text #21553

Closed

Description

@mstroppel

The first example in section "Owners, consumers, and lifetime management" does not match to the text. E.g. Span<T>.Clear is never used in the example but mentioned in the text.


Document Details

⚠ Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

Activity

  1. self-assigned this
    on Jan 6, 2021
  2. added and removed
    ⌚ Not Triaged
    on Jan 6, 2021
  3. tdykstra commented on Jan 7, 2021

    @tdykstra
    Contributor

    @bartonjs Should buffer.Destroy() in the pseudo-code example be changed to buffer.Clear()?

  4. added
    waiting-on-feedback
    on Jan 7, 2021
  5. bartonjs commented on Jan 7, 2021

    @bartonjs
    Member

    Other text doesn't match the example, e.g. it says it has a Memory<char> but the sample uses a conceptual type called Buffer. I think it's intentional that the sample is using concepts instead of concrete types, so perhaps it's the prose that needs to be equally generalized.

    @GrabYourPitchforks was this you?

  6. tdykstra commented on Jan 25, 2021

    @tdykstra
    Contributor

    This example/text mismatch was reported earlier by #15934. This issue is a duplicate but since the other was just closed by our stale issue bot, I'll leave that one closed and this one open.

  7. tdykstra commented on Feb 5, 2021

    @tdykstra
    Contributor
  8. GrabYourPitchforks commented on Feb 5, 2021

    @GrabYourPitchforks
    Member

    The example was largely copied from https://gist.github.com/GrabYourPitchforks/4c3e1935fd4d9fa2831dbfcab35dffc6, but that was meant to describe more general concepts and wasn't really talking about Span<T> or Memory<T> as a technology. In fact, the original draft includes this text directly above the buffer sample:

    Let's stick a pin in Memory<T> for now and speak about buffers in more general terms.

    And aside from that one fragment, the rest of the section text doesn't mention Span<T> or Memory<T> at all.

    If we wanted to keep this section generalized as in the original draft, we should remove references to things like Span<T>.Clear, which aren't relevant to the sample code. Or, if we wanted to make this section specific to Span<T> or Memory<T>, we need to reconsider the sample. You can't "rent" spans (since they're abstractions). And I think this part of the article might be too early to introduce dangerous concepts like ArrayPool<T>.

  9. removed
    waiting-on-feedback
    on Feb 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions