Any way to automatically convert structs on return?

Juraj zero at vec4.xyz
Fri Aug 2 07:39:45 UTC 2024


On Thursday, 1 August 2024 at 07:25:53 UTC, Emma wrote:
> ```d
> Option!int something() {
>   return None(); // Error: cannot implicitly convert expression 
> `None()` of type `None` to `Option!int`
> }
> ```


Not D per se, but you can check Adam D. Ruppe's current work.
If I am not mistaken, the thing you are asking for is already 
possible in the nightly release.

https://dpldocs.info/this-week-in-arsd/Blog.Posted_2024_02_20.html#implicit-construction


Juraj


More information about the Digitalmars-d-learn mailing list