Thread overview
[Issue 22990] [dip1000] extended return semantics doesn't work on auto return
Sep 01, 2022
Walter Bright
Sep 01, 2022
Walter Bright
Sep 12, 2022
Dennis
Dec 17, 2022
Iain Buclaw
September 01, 2022
https://issues.dlang.org/show_bug.cgi?id=22990

Walter Bright <bugzilla@digitalmars.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |bugzilla@digitalmars.com

--- Comment #1 from Walter Bright <bugzilla@digitalmars.com> ---
Your analysis is correct, it's the `if (!tf.nextOf()) return false;`.

Perhaps the function can set a flag if it doesn't see any `return` statements.

--
September 01, 2022
https://issues.dlang.org/show_bug.cgi?id=22990

--- Comment #2 from Walter Bright <bugzilla@digitalmars.com> ---
(In reply to Walter Bright from comment #1)
> Perhaps the function can set a flag if it doesn't see any `return` statements.

Eh, that means scanning the statement AST before semantic analysis, i.e. slow.

I don't think this is a particular problem anyway, as why would one return `auto` if there are no `return` statements?

--
September 12, 2022
https://issues.dlang.org/show_bug.cgi?id=22990

--- Comment #3 from Dennis <dkorpel@live.nl> ---
(In reply to Walter Bright from comment #2)
> (In reply to Walter Bright from comment #1)
> > Perhaps the function can set a flag if it doesn't see any `return` statements.
> 
> I don't think this is a particular problem anyway, as why would one return `auto` if there are no `return` statements?

To enable attribute inference on the function, or because it's a generic function which returns based on template parameters.

I don't have a concrete use case so I don't think there's much priority to support this, but if it's not going to be supported, then at least the limitation should be in the specification.

--
December 17, 2022
https://issues.dlang.org/show_bug.cgi?id=22990

Iain Buclaw <ibuclaw@gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Priority|P1                          |P4

--