syntax sugar: std.path::buildPath instead of from!"std.path".buildPath

Timothee Cour via Digitalmars-d digitalmars-d at puremagic.com
Wed Feb 15 12:09:46 PST 2017


This thread completely diverged from the original post, which was propsing
`::` instead of `from!`:

```
void fun(T)(std.stdio::File input, T value) if (std.traits::isIntegral!T)
{...}
```

instead of:

```
void fun(T)(Module!"std.stdio".File input, T value) if
(Module!"std.traits".isIntegral!T)
{...}
```

I see it as a clear improvment in readability (see original post for
details along with shortcomings of `from!` approach )


On Wed, Feb 15, 2017 at 11:39 AM, Andrei Alexandrescu via Digitalmars-d <
digitalmars-d at puremagic.com> wrote:

> On 02/15/2017 06:20 AM, Daniel N wrote:
>
>> On Wednesday, 15 February 2017 at 09:22:14 UTC, Daniel N wrote:
>>
>>> template every(T...)
>>> {
>>>     template satisfies(U...)
>>>     {
>>>         enum satisfies = true;
>>>     }
>>> }
>>>
>>
>> (lunch-break => time to hack D!)
>>
>> template every(T...)
>> {
>>   template satisfies(U...)
>>   {
>>     enum satisfies = {
>>       foreach(t; T)
>>         foreach(u; U)
>>       if(!u!t)
>>             return false;
>>       return true;
>>     }();
>>   }
>> }
>>
>
> That looks pretty neat. Can you find 4-5 cases in which this could be used
> gainfully in Phobos? Thanks! -- Andrei
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20170215/c91ab5db/attachment.html>


More information about the Digitalmars-d mailing list