[swift-dev] What do to when stdlib guidelines conflict with proposal?

Russ Bishop xenadu at gmail.com
Wed May 11 22:17:14 CDT 2016


> On May 11, 2016, at 4:50 PM, Dmitri Gribenko <gribozavr at gmail.com> wrote:
> 
> On Wed, May 11, 2016 at 2:53 PM, Russ Bishop via swift-dev
> <swift-dev at swift.org> wrote:
>> I’m implementing SE-0017 but based on the standard library guidelines I think Unmanaged should have initializers that take UnsafePointer/UnsafeMutablePointer and vice-versa which would fit more naturally with the way other conversions work.
>> 
>> A later commit already moved toOpaque to be an initializer on OpaquePointer. I would add convenience initializers to UnsafePointer as well.
>> 
>> Any objections to just implementing this as initializers and marking fromOpaque as deprecated? I’m not sure how strict we should be in sticking to the proposal.
> 
> Unmanaged shall be redesigned.  We thought about this change, and
> decided to go for the incremental change as proposed.  Bigger changes
> should be considered as a part of a cohesive Unmanaged redesign.
> 

Why did someone move toOpaque then? It seems like the door was already opened there - it isn’t possible to stick to the proposal as approved anyway.

I can certainly move it back but the initializer vs static seems like a best-practices and library design issue orthogonal to Unmanaged itself. 


At the end of the day if the core team still prefers to go with the fromOpaque/toOpaque approach I’m happy to implement it (in fact I have both implemented locally right now).


Russ


> Dmitri
> 
> -- 
> main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
> (j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/



More information about the swift-dev mailing list