On Monday, 21 September 2015 at 11:01:27 UTC, ZombineDev wrote:
I prefer library-defined smart pointers than language magic, because you can easily modify them to fit your needs. What D needs is a way to enforce that the user can't get unmanaged references to the underlying object managed by the smart pointer.

That's ok. I've done that in my own prototype library by having a "movingptr!T" returned by doing "move(someuniqueptr)" and "borrowptr!T" returned by "borrow(...)". But checking is limited to runtime asserts in destructors in debug builds.

It is ok as a runtime hack... but not a competitive solution.

The killer way to implement this in D is to NOT add complexity in the compiler (and to change the whole language to some imaginable perfect correct memory management system), but to add away for the library writers to write extensible CTFE checkers that enforce the smart pointer invariants at compile-time.

That is most likely even more work than creating a language solution?


              • ... Ola Fosheim Grøstad via Digitalmars-d-announce
              • ... Daniel Kozak via Digitalmars-d-announce
        • Re: Go 1.5 Robert M. Münch via Digitalmars-d-announce
    • Re: Go 1.5 Rory McGuire via Digitalmars-d-announce
    • Re: Go 1.5 Ola Fosheim Grøstad via Digitalmars-d-announce
  • Re: Go 1.5 Chris via Digitalmars-d-announce
    • Re: Go 1.5 Ola Fosheim Grøstad via Digitalmars-d-announce
      • Re: Go 1.5 Chris via Digitalmars-d-announce
        • Re: Go 1.5 Ola Fosheim Grøstad via Digitalmars-d-announce
        • Re: Go 1.5 ZombineDev via Digitalmars-d-announce
          • Re: Go 1.... Ola Fosheim Grøstad via Digitalmars-d-announce
            • Re: ... Chris via Digitalmars-d-announce
              • ... Ola Fosheim Grøstad via Digitalmars-d-announce
          • Re: Go 1.... jmh530 via Digitalmars-d-announce
            • Re: ... Ola Fosheim Grøstad via Digitalmars-d-announce
              • ... jmh530 via Digitalmars-d-announce
              • ... Ola Fosheim Grostad via Digitalmars-d-announce
              • ... Chris via Digitalmars-d-announce
              • ... Ola Fosheim Grøstad via Digitalmars-d-announce
              • ... Johannes Pfau via Digitalmars-d-announce
  • Re: Go 1.5 Martin Nowak via Digitalmars-d-announce

Reply via email to