Thread overview
[Issue 23491] Nonsensical deprecation message when using delegate
Nov 18, 2022
RazvanN
Nov 18, 2022
Mathias LANG
Nov 18, 2022
Dennis
Nov 21, 2022
Dlang Bot
Nov 28, 2022
Dlang Bot
November 18, 2022
https://issues.dlang.org/show_bug.cgi?id=23491

RazvanN <razvan.nitu1305@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |razvan.nitu1305@gmail.com

--- Comment #1 from RazvanN <razvan.nitu1305@gmail.com> ---
I would argue that problem number 2 is not valid. The compiler just looks at the signature and it sees that unsignedToTempString has a scope return parameter and assumes that that is the one you are returning so it mentions that one. It makes more sense to mention the variable that the user can actually change, rather than the library function parameter which cannot.

However, points 1 and 3 definitely need fixing.

--
November 18, 2022
https://issues.dlang.org/show_bug.cgi?id=23491

--- Comment #2 from Mathias LANG <pro.mathias.lang@gmail.com> ---
(In reply to RazvanN from comment #1)
> I would argue that problem number 2 is not valid. The compiler just [...]

The problem I see is that the message is misleading without extra information. In this case, to understand it, one needs to look at `unsignedToTempString` signature. The fix, in that case, is to change `sink` signature.

Note that I am not saying that the message is *incorrect* (it most definitely is correct) or that it shouldn't mention `buffer` - Just that it can & should be improved, perhaps with an `errorSupplemental` (`deprecationSupplemental` here) so that people don't get stuck looking at the call that returns the reference, instead of how the returned reference is used.

--
November 18, 2022
https://issues.dlang.org/show_bug.cgi?id=23491

Dennis <dkorpel@live.nl> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |dkorpel@live.nl

--- Comment #3 from Dennis <dkorpel@live.nl> ---
(In reply to Mathias LANG from comment #2)
> Note that I am not saying that the message is *incorrect* (it most definitely is correct) or that it shouldn't mention `buffer` - Just that it can & should be improved, perhaps with an `errorSupplemental` (`deprecationSupplemental` here) so that people don't get stuck looking at the call that returns the reference, instead of how the returned reference is used.

I'm working on a fix for the `` bug and `__anonymous_param`, I'll leave the mentioning of `unsignedToTempString` as a future enhancement since currently the information where `buffer` got escaped from is discarded, so it requires a lot of refactoring of `escapeByValue` and `escapeByRef`.

--
November 21, 2022
https://issues.dlang.org/show_bug.cgi?id=23491

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Keywords|                            |pull

--- Comment #4 from Dlang Bot <dlang-bot@dlang.rocks> ---
@dkorpel created dlang/dmd pull request #14649 "Fix 23491 - Nonsensical deprecation message when using delegate" fixing this issue:

- Fix 23491 - Nonsensical deprecation message when using delegate

https://github.com/dlang/dmd/pull/14649

--
November 28, 2022
https://issues.dlang.org/show_bug.cgi?id=23491

Dlang Bot <dlang-bot@dlang.rocks> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|---                         |FIXED

--- Comment #5 from Dlang Bot <dlang-bot@dlang.rocks> ---
dlang/dmd pull request #14649 "Fix 23491 - Nonsensical deprecation message when using delegate" was merged into master:

- d637dfdf254fd7e63b485f6570723849e28e36eb by Dennis Korpel:
  Fix 23491 - Nonsensical deprecation message when using delegate

https://github.com/dlang/dmd/pull/14649

--