> On 22 Sep 2016, at 23:57, Michael Gottesman <mgottes...@apple.com> wrote:
> 
>> As a result the following transfer of a Java instance always worked:
>> 
>>     init(imageProducer:ImageProducer) {
>>         let supr = CanvasBase()
>>         super.init( javaObject: supr.javaObject )
>>         image = createImage(imageProducer)
>>     }
>> 
>> But the following only worked for debug compiles:
>> 
>>     init(imageProducer:ImageProducer) {
>>         super.init( javaObject: CanvasBase().javaObject )
>>         image = createImage(imageProducer)
>>     }
>> 
>> Felt like a bit of a bear trap is all. Statement scope would avoid problems 
>> like this.
> 
> You are thinking about this the inverse way. That the first case works is an 
> artifact of the optimizer failing to do a good enough job. Future improved 
> ARC optimization can cause both to fail.

Were this the case I think it would be a step in the wrong direction. Swift is 
getting
very eager at deallocating objects hence all the "withXYZ()" methods of late 
which
seem like noise to me. Certainly, having something perform differently from 
debug
to release builds was not a feature! Viva la Statement Scope which solves all 
this.

John
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution

Reply via email to