Am Fri, 31 Oct 2014 13:16:15 +0000 schrieb "eles" <[email protected]>:
> On Friday, 31 October 2014 at 10:06:51 UTC, Ola Fosheim Grøstad > wrote: > > On Friday, 31 October 2014 at 09:58:41 UTC, ketmar via > > Digitalmars-d wrote: > >> if you have something concrete in mind, write ER or forum > >> post, so we can destroy it. ;-) > > > - make uniqe_ptr a language builtin > > I would go with this by default for all pointers/references. > > Something that I read here: > > https://news.ycombinator.com/item?id=7650917 > > My feeling too. > > If you need more owners for a resource, then explicitly ask for. In case of a onDraw callback the object will be passed as a parameter into the drawing function. unique_ptr doesn't solve this. In the particular case of callbacks from C libraries that give us opaque "context" pointers we want to wrap with D classes we can use either of: - reference counted object (doesn't exist in D) - unique_ptr (requires "scope" to be implemented) - Scoped ? Maybe Scoped wasn't explored enough for callbacks in GtkD. But yeah, you'd still need one of the others to deal with external resources where the lifetime is not a specific stack frame. -- Marco
