> On Jul 18, 2016, at 10:05 PM, Charlie Monroe <[email protected]> > wrote: > >> I haven't used `ManagedBuffer`, but would it make sense to change the >> signature of `initialHeader` to `@noescape (elements: >> UnsafeMutablePointer<Element>, capacity: Int) -> Header` and then >> effectively run it inside a `withUnsafeMutablePointerToElements()` call? >> That would prevent access to the uninitialized `header` field while also >> allowing us to eliminate the `ManagedProtoBuffer` type. > > Wouldn't this disallow access to the capacity field? That's as well defined > on ManagedProtoBuffer and AFAIK can be accessed during the initialization.
Yes, which is why I suggested it should be passed in to the `initialHeader` closure too. (It's read-only anyway, so there's no loss of capability.) What it *does* prevent access to is `withUnsafeMutablePointerToHeader`, but I'm not sure how that method is supposed to work before the header's been initialized anyway. -- Brent Royal-Gordon Architechies _______________________________________________ swift-evolution mailing list [email protected] https://lists.swift.org/mailman/listinfo/swift-evolution
