Thread overview
[Issue 21137] Can't get the UDA given to the lambda expression parameters
Aug 10, 2020
Simen Kjaeraas
Aug 10, 2020
SHOO
Aug 10, 2020
Simen Kjaeraas
Dec 17, 2022
Iain Buclaw
August 10, 2020
https://issues.dlang.org/show_bug.cgi?id=21137

Simen Kjaeraas <simen.kjaras@gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |simen.kjaras@gmail.com
         Resolution|---                         |DUPLICATE

--- Comment #1 from Simen Kjaeraas <simen.kjaras@gmail.com> ---


*** This issue has been marked as a duplicate of issue 20246 ***

--
August 10, 2020
https://issues.dlang.org/show_bug.cgi?id=21137

SHOO <zan77137@nifty.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|DUPLICATE                   |---

--- Comment #2 from SHOO <zan77137@nifty.com> ---
(In reply to Simen Kjaeraas from comment #1)
> 
> *** This issue has been marked as a duplicate of issue 20246 ***

The subject of this issue is not about checking that template functions can be
called, as discussed in issue 20246.
This issue is about being able to retrieve UDAs given to parameters of lambda
and function literals (or template functions).
Since they cannot be evaluated by `isCallable!func`, and the parameter
information by `Paramters!func` cannot be retrieved, an alternative method
should be provided.
This issue is not solved by issue 20246, although it is similar in that it is
indeed a problem caused by not being treated as a function.

--
August 10, 2020
https://issues.dlang.org/show_bug.cgi?id=21137

--- Comment #3 from Simen Kjaeraas <simen.kjaras@gmail.com> ---
You're right, my mind was somewhere else when I did that. The problem is, D's templates are complicated beasts (and untyped lambdas are templates), and the information is undecidable in the general case:

    template foo(bool b, T) {
        static if (b) {
            void foo(@(T) T i) {}
        } else {
            enum T foo = T.init;
        }
    }

We don't know if the above even is a function, and even if we remove the bool parameter, there's no possible type for the UDA on the parameter 'i' without an explicit instantiation (and figuring out what template arguments are valid is also a hard problem).

We could possibly expose a __traits that gives access to this information in the limited cases where the template body has exactly one member which is a function and whose parameters' UDAs can be determined.

IMO, this is material for a DIP on template introspection, possibly AST macros.

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

Iain Buclaw <ibuclaw@gdcproject.org> changed:

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

--
December 13
https://issues.dlang.org/show_bug.cgi?id=21137

--- Comment #4 from dlangBugzillaToGithub <robert.schadek@posteo.de> ---
THIS ISSUE HAS BEEN MOVED TO GITHUB

https://github.com/dlang/dmd/issues/19761

DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB

--