Concurrency introduced us to the “what color is your function” problem, and I suddenly find myself imagining…

What if Xcode *actually colored* the code based on its isolation? All MainActor code is black, all ambiguous code is gray, all actor-bound code is a color picked for that actor…

@davedelong I have heard variations of this a lot! And while I do find the idea fascinating, one thing I never struggle with is actor ambiguity. I think it’s really similar to (but definitely not identical to!) having an intuition for the `self` variable. But having hover or some other kind of at-a-glance info for the current function scope could be handy for sure!

@davedelong

I wanted Xcode to be able to do this based on other things..like if you're doing a “full stack" or other multi-target project, so i know if i'm in serverside code or client code or shared code.

@davedelong I kind of think I'd find this more useful at the call location rather than the definition. Coloring the `await`s somehow, maybe.
@davedelong
I’ve always liked how IntelliJ (and friends) add extra context inline with the code, like inferrred types, and parameter names when calling functions.
That might be more accessible than relying on colours…
Tito Ciuro (@[email protected])

@[email protected] re: “The most impactful change Apple can make to make Swift concurrency less confusing is to show the inferred executor context for each line of code in Xcode. Make it really obvious what code runs on the main actor, some other actor, or the global cooperative pool. Use colors or whatnot!” I think this is a great idea! Similar to code coverage, which uses the gutter to indicate line-by-line status.

Mastodon 🐘