Skip to content

Add to definition of P<T> type to Appendix D: Code Index #182

Closed

Description

@alexreg

And why it's needed.

Activity

  1. added
    E-help-wantedCall for participation: extra help is wanted
    E-mediumDifficulty: might require some prior knowledge or code reading
    on Aug 20, 2018
  2. alexreg commented on Aug 20, 2018

    @alexreg
    ContributorAuthor

    @eddyb's definition of it is an "immutable Box<T>". I suppose it's needed just due to the nature of tree data structures?

  3. eddyb commented on Aug 20, 2018

    @eddyb
    Contributor

    It's not "needed", not to a large extent. The actual code has (potentially-outdated) documentation.

  4. alexreg commented on Aug 20, 2018

    @alexreg
    ContributorAuthor

    @eddyb Well, heap allocation is surely needed, otherwise we'd have to deal with an immutable tree, and that would be very expensive during construction and later modification.

  5. eddyb commented on Aug 21, 2018

    @eddyb
    Contributor

    I mean as a separate concept from Box or anything else.

  6. mark-i-m commented on Aug 21, 2018

    @mark-i-m
    Contributor

    Sorry, I'm not sure I understand. We use P when we need an owned immutable pointer. We can't use &T because that is not owned and we can't use Box because it is not immutable. Is that correct?

  7. alexreg commented on Aug 21, 2018

    @alexreg
    ContributorAuthor

    @eddyb Right, fair.

    @mark-i-m More or less, yes... @eddyb is saying that P<> doesn't really provide anything new over Box<> though – it's just a new-type with a immutability guarantee.

  8. added
    E-easyDifficulty: might be a good place for a beginner
    and removed
    E-mediumDifficulty: might require some prior knowledge or code reading
    on Aug 21, 2018
  9. added a commit that references this issue on Jan 24, 2019
    259fe68
  10. added a commit that references this issue on Jan 24, 2019
    658ce40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    E-easyDifficulty: might be a good place for a beginner

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions