Playgrounds should prioritize displaying return values over execution counts

Originator:ole.begemann
Number:rdar://27763378 Date Originated:09-Aug-2016 01:03 PM
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode 8 beta 4 (8S188o)
Classification:UI/Usability Reproducible:Always
 
Summary:
The playground sidebar in Xcode currently favors displaying the execution count of a line (e.g. "(6 times)") over the return value if the line has been executed multiple times. I think this priority is wrong in the vast majority of cases where playgrounds are used. Return values are more important and should be displayed by default.

Steps to Reproduce:
1. Create a new playground in Xcode.
2. Paste this code into the playground:

    let nums = [1,2,3,4,5]
    nums.map { $0 * 2 }

Expected Results:
The playground sidebar (where the return values are displayed) for line 2 should display the return value of the map method, i.e. "[2, 4, 6, 8, 10]".

Actual Results:
The playground sidebar does display "[1, 2, 3, 4, 5]" for line 1, but it displays "(6 times)" for line 2. In order to see the return value of my code, I have to modify the code like this:

    let nums = [1,2,3,4,5]
    let result = nums.map { $0 * 2 }
    result

This is not hard, but it gets tedious very fast when experimenting.

Regression:
n/a

Notes:
While I think the return values are more important in the vast majority of cases, the execution count information is certainly helpful and would be good to have. Perhaps it is possible to combine both pieces of info into a single line or maybe show the execution count in a popover on demand?

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!