October 08, 2021
On Friday, 8 October 2021 at 10:19:40 UTC, ikod wrote:
> On Friday, 8 October 2021 at 06:38:17 UTC, bauss wrote:
>> On Thursday, 7 October 2021 at 23:20:15 UTC, Imperatorn wrote:
>>> On Thursday, 7 October 2021 at 22:35:23 UTC, russhy wrote:
>>>> I don't think trying to replicate C# async/await is a good idea, it promotes creating bad APIs (GetThisAsync | GetThisAsync.ButSyncThisTimeToGetResult)
>
>>
>> Ex.
>>
>> DownloadFile() would be synchronous, whereas DownloadFileAsync() would then be async.
>
> This is not always useful to have different names for interfaces, especially when application developer decide for some performance/scalability/etc reason to port sync code to async environment.
>
> DownloadFile can be implemented such that it detects if it work in sync or async environment like (in pseudocode):
>
>
> void DownloadFile() {
>     if (activeEventLoopDetected) {
>         wait asyncCode
>     } else {
>         call syncCode
>     }
> }
>
>>
>> That avoids the whole problem of calling an async method synchronous, because in general you shouldn't ever do that anyway!

I'm not saying it's the best way to do it. I'm just stating that's the standard way in C#.
October 08, 2021

On Friday, 8 October 2021 at 11:34:29 UTC, jfondren wrote:

>

On Friday, 8 October 2021 at 11:14:54 UTC, Imperatorn wrote:

>

[...]

D doesn't have AST macros, which is what the usual transformation requires:

[...]

Sad

October 08, 2021

On Friday, 8 October 2021 at 12:21:50 UTC, Imperatorn wrote:

>

On Friday, 8 October 2021 at 11:34:29 UTC, jfondren wrote:

>

On Friday, 8 October 2021 at 11:14:54 UTC, Imperatorn wrote:

>

[...]

D doesn't have AST macros, which is what the usual transformation requires:

[...]

Sad

D doesn't have any syntax to support an actor framework either, but it still has a very natural one in std.concurrency. It doesn't have any syntax to support pattern matching over ML datatypes but it has std.sumtype. If you focus on functionality first and syntax later, you might find you want that much for syntax in the end.

October 08, 2021

On Friday, 8 October 2021 at 12:30:18 UTC, jfondren wrote:

>

On Friday, 8 October 2021 at 12:21:50 UTC, Imperatorn wrote:

>

On Friday, 8 October 2021 at 11:34:29 UTC, jfondren wrote:

>

On Friday, 8 October 2021 at 11:14:54 UTC, Imperatorn wrote:

>

[...]

D doesn't have AST macros, which is what the usual transformation requires:

[...]

Sad

D doesn't have any syntax to support an actor framework either, but it still has a very natural one in std.concurrency. It doesn't have any syntax to support pattern matching over ML datatypes but it has std.sumtype. If you focus on functionality first and syntax later, you might find you want that much for syntax in the end.

Hmm, I just assumed that it did because it's so similar to Erlang

1 2
Next ›   Last »