digitalmars.D - How about a new property for class and struct to get the fully
- Heromyth (16/16) Jul 16 2020 How about a new property for class and struct like `.stringof` to
- rikki cattermole (8/13) Jul 16 2020 @Middleware(fullyQualifiedName!IpFilterMiddleware,
- Per =?UTF-8?B?Tm9yZGzDtnc=?= (2/16) Jul 17 2020 Yes, please
- Stefan Koch (7/21) Jul 17 2020 It's not so easy to do that.
- Meta (3/19) Jul 17 2020 Note that you can also make an alias for fullyQualifiedName:
- Stefan Koch (3/19) Jul 17 2020 There is a second reason for wanting it, which is that the
How about a new property for class and struct like `.stringof` to get the fully qualified name? I know the `fullyQualifiedName` can do this. If a new property like `.qualifiedName` added to class and struct, the code blown: Middleware(fullyQualifiedName!(IpFilterMiddleware), fullyQualifiedName!(BasicAuthMiddleware)) Action string security() { return "It's a security page."; } may be changed as: Middleware(IpFilterMiddleware.qualifiedName, BasicAuthMiddleware.qualifiedName) Action string security() { return "It's a security page."; } It looks better, does it?
Jul 16 2020
On 17/07/2020 2:44 PM, Heromyth wrote:Middleware(fullyQualifiedName!(IpFilterMiddleware), fullyQualifiedName!(BasicAuthMiddleware)) Action string security() { return "It's a security page."; }Middleware(fullyQualifiedName!IpFilterMiddleware, fullyQualifiedName!BasicAuthMiddleware) Action string security() { return "It's a security page."; } I would prefer we offered UFCS to work on types instead. This would give the same syntax as you wanted and it is not specific to the use case.
Jul 16 2020
On Friday, 17 July 2020 at 03:19:18 UTC, rikki cattermole wrote:On 17/07/2020 2:44 PM, Heromyth wrote:Yes, pleaseMiddleware(fullyQualifiedName!(IpFilterMiddleware), fullyQualifiedName!(BasicAuthMiddleware)) Action string security() { return "It's a security page."; }Middleware(fullyQualifiedName!IpFilterMiddleware, fullyQualifiedName!BasicAuthMiddleware) Action string security() { return "It's a security page."; } I would prefer we offered UFCS to work on types instead. This would give the same syntax as you wanted and it is not specific to the use case.
Jul 17 2020
On Friday, 17 July 2020 at 03:19:18 UTC, rikki cattermole wrote:On 17/07/2020 2:44 PM, Heromyth wrote:It's not so easy to do that. type function do attempt that and indeed with my WIP type function extension you could do a fullyQualifiedName type-function which, (because type functions are regular functions) is callable with UFCS. (And it avoids the template instance overhead.)Middleware(fullyQualifiedName!(IpFilterMiddleware), fullyQualifiedName!(BasicAuthMiddleware)) Action string security() { return "It's a security page."; }Middleware(fullyQualifiedName!IpFilterMiddleware, fullyQualifiedName!BasicAuthMiddleware) Action string security() { return "It's a security page."; } I would prefer we offered UFCS to work on types instead. This would give the same syntax as you wanted and it is not specific to the use case.
Jul 17 2020
On Friday, 17 July 2020 at 02:44:52 UTC, Heromyth wrote:How about a new property for class and struct like `.stringof` to get the fully qualified name? I know the `fullyQualifiedName` can do this. If a new property like `.qualifiedName` added to class and struct, the code blown: Middleware(fullyQualifiedName!(IpFilterMiddleware), fullyQualifiedName!(BasicAuthMiddleware)) Action string security() { return "It's a security page."; } may be changed as: Middleware(IpFilterMiddleware.qualifiedName, BasicAuthMiddleware.qualifiedName) Action string security() { return "It's a security page."; } It looks better, does it?Note that you can also make an alias for fullyQualifiedName: import fqn = std.traits: fullyQualifiedName;
Jul 17 2020
On Friday, 17 July 2020 at 02:44:52 UTC, Heromyth wrote:How about a new property for class and struct like `.stringof` to get the fully qualified name? I know the `fullyQualifiedName` can do this. If a new property like `.qualifiedName` added to class and struct, the code blown: Middleware(fullyQualifiedName!(IpFilterMiddleware), fullyQualifiedName!(BasicAuthMiddleware)) Action string security() { return "It's a security page."; } may be changed as: Middleware(IpFilterMiddleware.qualifiedName, BasicAuthMiddleware.qualifiedName) Action string security() { return "It's a security page."; } It looks better, does it?There is a second reason for wanting it, which is that the fullyQualified name template is rather expensive to instantiate.
Jul 17 2020