On Wednesday, 10 August 2016 at 20:35:23 UTC, Dicebot wrote:
- At this point the question I'd personally suggest to be evaluated is "does this proposal enable enough useful designs?". A good check would be to try taking some of your projects and see if having DIP1000 approved and implemented could improve them.


There's a use-case that relates to some of our discussions together in another context, about structs or classes that borrow data via ref:

    struct MyWrapperStruct (T)
    {
        private T* data;

        public this (ref T input)
        {
            this.data = &input;
        }

        // ... other functionality relies on
        // this.data being valid throughout
        // the lifetime of the struct

        // note, we could probably avoid everyone
        // having to use raw pointers as above if
        // we could use scope properties to create
        // a `Ref` borrowed-pointer type that would
        // complement the existing `Unique`
    }

I don't see any examples touching on this, but it would be very useful for implementing e.g. InputRange structs which cannot be copied by value, yet which need to be usable with UFCS range chains.

Any chance the proposal authors could add some examples of how scope could affect class/struct fields which borrow data by reference (meaning the class/struct instance should not escape the scope of the input data)?
            • R... Walter Bright via Digitalmars-d-announce
              • ... Timon Gehr via Digitalmars-d-announce
              • ... Walter Bright via Digitalmars-d-announce
          • Re: DI... Timon Gehr via Digitalmars-d-announce
            • R... Walter Bright via Digitalmars-d-announce
  • Re: DIP1000: Scoped Poi... Sönke Ludwig via Digitalmars-d-announce
  • Re: DIP1000: Scoped Poi... Joseph Rushton Wakeling via Digitalmars-d-announce
    • Re: DIP1000: Scope... Joseph Rushton Wakeling via Digitalmars-d-announce
    • Re: DIP1000: Scope... Walter Bright via Digitalmars-d-announce
      • Re: DIP1000: S... Joseph Rushton Wakeling via Digitalmars-d-announce
        • Re: DIP100... Walter Bright via Digitalmars-d-announce
          • Re: DI... Joseph Rushton Wakeling via Digitalmars-d-announce
            • R... Joseph Rushton Wakeling via Digitalmars-d-announce
              • ... Walter Bright via Digitalmars-d-announce
              • ... Joseph Rushton Wakeling via Digitalmars-d-announce
              • ... Walter Bright via Digitalmars-d-announce
              • ... Joseph Rushton Wakeling via Digitalmars-d-announce

Reply via email to