> On Aug 28, 2017, at 1:14 PM, Florent Vilmart <flor...@flovilmart.com> wrote:
>
> I can see where you're going with that.
> For me, the big unknown (and unspecified so far) is
>
> func process() async -> Image { ... }
>
> let result = process() // what is result? CoroutineType<Image> ?
>
> or am I missing something here?
By the rules of the proposal I think this is a compiler error.
In C# the async keyword does not affect the caller at all. The above example
would be like this (using C# syntax):
Task<Image> Process();
Task<Image> result1 = Process();
Image result2 = await Process();
Some people dislike this behavior. If you forget the await keyword you get the
future type instead of the actual result. That’s a little bit confusing.
However, you would only be confused until you try to compile your code and find
that the type isn’t what you think it is. I can’t think of a scenario in which
you would actually be able to compile the code and get the wrong result and
have trouble understanding why. You would just get an error from the compiler
when trying to access properties that don’t exist (or, more likely, notice that
code completion is not giving you what you expect).
Personally I think this is a feature, not a bug. This is what allows you to
easily mix async/await with futures.
_______________________________________________
swift-evolution mailing list
swift-evolution@swift.org
https://lists.swift.org/mailman/listinfo/swift-evolution