Second Draft: Coroutines

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Mon Feb 3 23:42:55 UTC 2025


On 04/02/2025 10:43 AM, Mai Lapyst wrote:
> On Friday, 31 January 2025 at 16:12:43 UTC, Richard (Rikki) Andrew 
> Cattermole wrote:
>> Perma: https://gist.github.com/rikkimax/ 
>> fe2578e1dfbf66346201fd191db4bdd4/7bba547fb6ea09deb2f0cfda2d852c409ace0142
> 
> There's still no writing about `opConstructCo`. Maybe a bit of 
> background will help you. I'm in the process of writing an own frontend 
> for the dlang language, and for me as an sudden implementor of the 
> language, I find myself inside a unique spot for interacting wich such 
> feature requests.

"In the following example, a new operator overload ``opConstructCo`` 
static method is used in an example definition of a library type that 
represents a coroutine. It is later used in the construction of the 
library type from the language representation of it."

Is that better?

A link to your frontend would be appreciated, I'd like to see if you've 
done UAX31/C23 identifiers (yet).

> Like I said; you explaint that only `opConstructCo` is the method / 
> function that should be called to construct coroutines by the AST 
> lowering, even called it a "new operator", but you still failed to 
> include it in the section for changes to the language documentation. 
> While it's correct that it's not needed for the grammar section, it is 
> described in an text with starts with "a *potential* shell" telling me 
> as a implementor that this is **not** required while infact it is; just 
> like you said: its an new operator, so it should be clearly marked as 
> such. Maybe in a new section after the grammar changes, or wherever, as 
> long as it's more clearly that it is required as you yourself said:

Its not in the grammar section because operator overloads are not here:

https://dlang.org/spec/grammar.html

>> It is not part of the DIP. Without the operator overload example, it 
>> wouldn't be understood.
>> ....
>> The operator overload ``opConstructCo`` is part of the DIP.
>> Therefore there are examples for it.
> 
> So it is part of the DIP! Please state it so without adding "potential" 
> or "purpose of examples only" before the **only occurence** of it inside 
> the whole document.
> 
> Maybe a change like this:
> ```
> # Implementation
> 
> ...
> 
> Implementors also need to be aware of the new `opConstructCo` operator 
> which is used as an way to morph coroutine objects into library 
> understandable types.
> ```
> Or something similar.

See above.



More information about the dip.development mailing list