is(x = module) vs. __traits(isModule, x)
    Steven Schveighoffer 
    schveiguy at gmail.com
       
    Thu Oct  8 14:19:08 UTC 2020
    
    
  
On 10/8/20 10:08 AM, H. S. Teoh wrote:
> On Thu, Oct 08, 2020 at 12:54:49PM +0000, Adam D. Ruppe via Digitalmars-d wrote:
>> On Thursday, 8 October 2020 at 10:11:59 UTC, Max Samukha wrote:
>>> Wrapping __traits in templates is a necessity if you want to use
>>> them for anything interesting (such as passing them to higher order
>>> functions):
>>
>> I kinda wish we had a template lambda.
> 
> Me too!!!  I've been avoiding to use Filter, et al, because I'm forced
> to declare a bunch of helper templates just for trivial predicates. If
> lambda syntax could be extended to templates, that would make it much
> nicer to use.
We recently had the AliasSeq pattern recognized by the compiler and it 
no longer stores a template for it.
can we do the same thing for __traits? In other words, it can recognize 
the pattern:
template foo(...)
{
    alias foo = __traits(...);
}
And avoid setting up templates for this.
I think the AliasSeq pattern still runs through the template machinery, 
which is not a good thing. But perhaps this can be addressed orthogonally.
-Steve
    
    
More information about the Digitalmars-d
mailing list