async / await
jfondren
julian.fondren at gmail.com
Fri Oct 8 11:34:29 UTC 2021
On Friday, 8 October 2021 at 11:14:54 UTC, Imperatorn wrote:
> If not integrated in the language via keywords, how could one
> accomplish it using the "keywords" anyway? Could udas be used?
> @async @await?
>
> Could "compile time magic" lower to something?
D doesn't have AST macros, which is what the usual transformation
requires:
https://github.com/nim-lang/Nim/blob/devel/lib/pure/asyncmacro.nim#L253
That's just syntax, though. It's putting the cart a hundred miles
before the horse to want syntax from dmd when the functionality
it would lower to is also not there. You could easily build
something over vibe's fiber scheduler and std.concurrency, but
it's not going to sell D to 'port' C# by transliterating it into
code with very different performance characteristics. It'd be
like dmd adding a goroutine syntax that lowers to the phobos
FiberShcheduler, where some benchmarks in Learn have it 8x slower
than go: it would be better to rethink that code for D.
If you want the familiar syntax, the better immediate goal is
some existing D syntax that works with a
tokio/asyncdispatch/etc.-competitive async scheduler.
>
> I find it hard to believe that it would be *impossible* since D
> is one of the most plastic statically typed languages I know.
More information about the Digitalmars-d
mailing list