Re: [swift-corelibs-dev] NSObject's performSelector(inBackground:with:) doesn't feel right in Swift 3

2016-08-16 Thread Shawn Erickson via swift-corelibs-dev
Ah yeah didn't notice the others got named that way without the selector
after perform. Yeah it seems like it was simply mismapped. I suggest
filling a radar about ASAP (not in the standard library realm).
On Tue, Aug 16, 2016 at 8:52 AM Philippe Hausler  wrote:

> I would claim that perhaps it should be:
>
> open func perform(inBackground aSelector: Selector, with anArgument: Any?)
>
> That way it matches the completion family of the rest of performing. But
> if that is the case we should take a look at the onMainThread ones as well
> so they look like this perhaps:
>
> open func perform(onMainThread aSelector: Selector, with arg: Any?,
> waitUntilDone wait: Bool, modes array: [String]?)
>
> That way the call sites would look like this:
>
> myObject.perform(inBackground: #selector(doBackgroundStuff), with: nil)
> myObject.perform(onMainThread: #selector(doMainThreadStuff), with: nil)
> myObject.perform(#selector(doDelayedThings), with: nil, afterDelay: 0.7)
> let result = myObject.perform(#selector(doThingsNow), with:
> nil).takeUnretainedValue()
>
> On Aug 16, 2016, at 8:46 AM, Shawn Erickson via swift-corelibs-dev <
> swift-corelibs-dev@swift.org> wrote:
>
> It is following the naming methodology of a sentence like structure
> "performed selector in background  with ". It does read a
> little strange but likely comes from a simple remapping of the existing
> objective-c name for familiarly reasons.
>
> It could be performInBackground(selector:,with:) ... "Perform in
> background  with " but that also reads a little strange.
>
> -Shawn
>
> On Tue, Aug 16, 2016 at 8:40 AM Paul Hudson via swift-corelibs-dev <
> swift-corelibs-dev@swift.org> wrote:
>
>> Hello!
>>
>> I just noticed that performSelectorInBackground(_:withObject:) has
>> been mapped to performSelector(inBackground:with:) in Swift 3. So:
>>
>> performSelector(inBackground: #selector(doStuff), with: nil)
>>
>> This seems confusing to me – the "inBackground" label has little to do
>> with the selector that is attached to it. It's possible this has been
>> through careful API review and if so I apologize. On the other hand,
>> if it's an oversight is there time for it to be looked at again?
>>
>> Thank you!
>>
>>
>> Paul
>> --
>> Free Swift tutorials – hackingwithswift.com
>> ___
>> swift-corelibs-dev mailing list
>> swift-corelibs-dev@swift.org
>> https://lists.swift.org/mailman/listinfo/swift-corelibs-dev
>>
> ___
> swift-corelibs-dev mailing list
> swift-corelibs-dev@swift.org
> https://lists.swift.org/mailman/listinfo/swift-corelibs-dev
>
>
>
___
swift-corelibs-dev mailing list
swift-corelibs-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-corelibs-dev


Re: [swift-corelibs-dev] NSObject's performSelector(inBackground:with:) doesn't feel right in Swift 3

2016-08-16 Thread Philippe Hausler via swift-corelibs-dev
I would claim that perhaps it should be:

open func perform(inBackground aSelector: Selector, with anArgument: Any?)

That way it matches the completion family of the rest of performing. But if 
that is the case we should take a look at the onMainThread ones as well so they 
look like this perhaps:

open func perform(onMainThread aSelector: Selector, with arg: Any?, 
waitUntilDone wait: Bool, modes array: [String]?)

That way the call sites would look like this:

myObject.perform(inBackground: #selector(doBackgroundStuff), with: nil)
myObject.perform(onMainThread: #selector(doMainThreadStuff), with: nil)
myObject.perform(#selector(doDelayedThings), with: nil, afterDelay: 0.7)
let result = myObject.perform(#selector(doThingsNow), with: 
nil).takeUnretainedValue()

> On Aug 16, 2016, at 8:46 AM, Shawn Erickson via swift-corelibs-dev 
>  wrote:
> 
> It is following the naming methodology of a sentence like structure 
> "performed selector in background  with ". It does read a 
> little strange but likely comes from a simple remapping of the existing 
> objective-c name for familiarly reasons.
> 
> It could be performInBackground(selector:,with:) ... "Perform in background 
>  with " but that also reads a little strange.
> 
> -Shawn
> 
> On Tue, Aug 16, 2016 at 8:40 AM Paul Hudson via swift-corelibs-dev 
> mailto:swift-corelibs-dev@swift.org>> wrote:
> Hello!
> 
> I just noticed that performSelectorInBackground(_:withObject:) has
> been mapped to performSelector(inBackground:with:) in Swift 3. So:
> 
> performSelector(inBackground: #selector(doStuff), with: nil)
> 
> This seems confusing to me – the "inBackground" label has little to do
> with the selector that is attached to it. It's possible this has been
> through careful API review and if so I apologize. On the other hand,
> if it's an oversight is there time for it to be looked at again?
> 
> Thank you!
> 
> 
> Paul
> --
> Free Swift tutorials – hackingwithswift.com 
> ___
> swift-corelibs-dev mailing list
> swift-corelibs-dev@swift.org 
> https://lists.swift.org/mailman/listinfo/swift-corelibs-dev 
> 
> ___
> swift-corelibs-dev mailing list
> swift-corelibs-dev@swift.org
> https://lists.swift.org/mailman/listinfo/swift-corelibs-dev

___
swift-corelibs-dev mailing list
swift-corelibs-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-corelibs-dev


Re: [swift-corelibs-dev] NSObject's performSelector(inBackground:with:) doesn't feel right in Swift 3

2016-08-16 Thread Shawn Erickson via swift-corelibs-dev
It is following the naming methodology of a sentence like structure
"performed selector in background  with ". It does read a
little strange but likely comes from a simple remapping of the existing
objective-c name for familiarly reasons.

It could be performInBackground(selector:,with:) ... "Perform in background
 with " but that also reads a little strange.

-Shawn

On Tue, Aug 16, 2016 at 8:40 AM Paul Hudson via swift-corelibs-dev <
swift-corelibs-dev@swift.org> wrote:

> Hello!
>
> I just noticed that performSelectorInBackground(_:withObject:) has
> been mapped to performSelector(inBackground:with:) in Swift 3. So:
>
> performSelector(inBackground: #selector(doStuff), with: nil)
>
> This seems confusing to me – the "inBackground" label has little to do
> with the selector that is attached to it. It's possible this has been
> through careful API review and if so I apologize. On the other hand,
> if it's an oversight is there time for it to be looked at again?
>
> Thank you!
>
>
> Paul
> --
> Free Swift tutorials – hackingwithswift.com
> ___
> swift-corelibs-dev mailing list
> swift-corelibs-dev@swift.org
> https://lists.swift.org/mailman/listinfo/swift-corelibs-dev
>
___
swift-corelibs-dev mailing list
swift-corelibs-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-corelibs-dev


Re: [swift-corelibs-dev] NSObject's performSelector(inBackground:with:) doesn't feel right in Swift 3

2016-08-16 Thread Philippe Hausler via swift-corelibs-dev

> On Aug 16, 2016, at 8:42 AM, Philippe Hausler via swift-corelibs-dev 
>  wrote:
> 
> Those methods should probably all belong to the same family of `perform` but 
> it matches the method naming of:
> 
> open func performSelector(onMainThread aSelector: Selector, with arg: Any?, 
> waitUntilDone wait: Bool, modes array: [String]?)
> 
> But perhaps the naming family should belong to this one:
> 
> open func perform(_ aSelector: Selector, on thr: Thread, with arg: Any?, 
> waitUntilDone wait: Bool)
> 
>> On Aug 15, 2016, at 3:53 PM, Paul Hudson via swift-corelibs-dev 
>>  wrote:
>> 
>> Hello!
>> 
>> I just noticed that performSelectorInBackground(_:withObject:) has
>> been mapped to performSelector(inBackground:with:) in Swift 3. So:
>> 
>> performSelector(inBackground: #selector(doStuff), with: nil)
>> 
>> This seems confusing to me – the "inBackground" label has little to do
>> with the selector that is attached to it. It's possible this has been
>> through careful API review and if so I apologize. On the other hand,
>> if it's an oversight is there time for it to be looked at again?

Unfortunately per timing wise we are really late in the game to fix the names 
of things. It would require a full API review to push through a better name for 
it. (However I agree that perhaps we should rename them)

Also there were a pair of block variants added to RunLoop that falls into this 
family:

open func perform(inModes modes: [RunLoopMode], block: @escaping () -> 
Swift.Void)
open func perform(_ block: @escaping () -> Swift.Void)

>> 
>> Thank you!
>> 
>> 
>> Paul
>> --
>> Free Swift tutorials – hackingwithswift.com
>> ___
>> swift-corelibs-dev mailing list
>> swift-corelibs-dev@swift.org
>> https://lists.swift.org/mailman/listinfo/swift-corelibs-dev
> 
> ___
> swift-corelibs-dev mailing list
> swift-corelibs-dev@swift.org
> https://lists.swift.org/mailman/listinfo/swift-corelibs-dev

___
swift-corelibs-dev mailing list
swift-corelibs-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-corelibs-dev


Re: [swift-corelibs-dev] NSObject's performSelector(inBackground:with:) doesn't feel right in Swift 3

2016-08-16 Thread Philippe Hausler via swift-corelibs-dev
Those methods should probably all belong to the same family of `perform` but it 
matches the method naming of:

open func performSelector(onMainThread aSelector: Selector, with arg: Any?, 
waitUntilDone wait: Bool, modes array: [String]?)

But perhaps the naming family should belong to this one:

open func perform(_ aSelector: Selector, on thr: Thread, with arg: Any?, 
waitUntilDone wait: Bool)

> On Aug 15, 2016, at 3:53 PM, Paul Hudson via swift-corelibs-dev 
>  wrote:
> 
> Hello!
> 
> I just noticed that performSelectorInBackground(_:withObject:) has
> been mapped to performSelector(inBackground:with:) in Swift 3. So:
> 
> performSelector(inBackground: #selector(doStuff), with: nil)
> 
> This seems confusing to me – the "inBackground" label has little to do
> with the selector that is attached to it. It's possible this has been
> through careful API review and if so I apologize. On the other hand,
> if it's an oversight is there time for it to be looked at again?
> 
> Thank you!
> 
> 
> Paul
> --
> Free Swift tutorials – hackingwithswift.com
> ___
> swift-corelibs-dev mailing list
> swift-corelibs-dev@swift.org
> https://lists.swift.org/mailman/listinfo/swift-corelibs-dev

___
swift-corelibs-dev mailing list
swift-corelibs-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-corelibs-dev


[swift-corelibs-dev] NSObject's performSelector(inBackground:with:) doesn't feel right in Swift 3

2016-08-16 Thread Paul Hudson via swift-corelibs-dev
Hello!

I just noticed that performSelectorInBackground(_:withObject:) has
been mapped to performSelector(inBackground:with:) in Swift 3. So:

performSelector(inBackground: #selector(doStuff), with: nil)

This seems confusing to me – the "inBackground" label has little to do
with the selector that is attached to it. It's possible this has been
through careful API review and if so I apologize. On the other hand,
if it's an oversight is there time for it to be looked at again?

Thank you!


Paul
--
Free Swift tutorials – hackingwithswift.com
___
swift-corelibs-dev mailing list
swift-corelibs-dev@swift.org
https://lists.swift.org/mailman/listinfo/swift-corelibs-dev