qwertie / ecsharp

Home of LoycCore, the LES language of Loyc trees, the Enhanced C# parser, the LeMP macro preprocessor, and the LLLPG parser generator.
http://ecsharp.net
Other
172 stars 25 forks source link

await fluent operator #124

Closed dzmitry-lahoda closed 3 years ago

dzmitry-lahoda commented 3 years ago

like pipe helps to do |> instead of .To(), that await fluent operator will allow to do var x = doAsync().await.SomeProp as it is done in rust https://rust-lang.github.io/async-book/01_getting_started/04_async_await_primer.html . so it will be better option for https://gist.github.com/dzmitry-lahoda/78bd89c3aa804aa0467dcba0a2e1defd#file-system-threading-tasks-funextensions-cs . rust is good version of csharp.

qwertie commented 3 years ago

Uhh, did you mean to add a comment on #113? As I mentioned, you can define this:

define operator.($x, awaited) { (await($x)); }

and use it like this:

_database.GetUsersByIds(...).awaited.ToList();