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

H. S. Teoh via Digitalmars-d digitalmars-d at puremagic.com
Tue Feb 14 11:15:06 PST 2017


On Tue, Feb 14, 2017 at 07:14:08PM +0000, bachmeier via Digitalmars-d wrote:
> On Tuesday, 14 February 2017 at 19:08:53 UTC, bachmeier wrote:
> 
> > I am not familiar with all of the past discussion of this issue, but
> > something that I have wondered is why we can't do something like
> > 
> > alias fooConstraint = (s != SwapStrategy.stable
> >   && isBidirectionalRange!Range
> >   && hasLvalueElements!Range
> >   && hasLength!Range
> >   && Offset.length >= 1);
> > 
> > Range remove
> >   (SwapStrategy s = SwapStrategy.stable, Range, Offset...)
> >   (Range range, Offset offset) if fooConstraint;
> 
> I mean, is there some reason that this shouldn't be allowed? Any
> feature can be abused, but it looks useful in many cases.

This is already possible:

	enum fooConstraint(R) = isBidirectionalRange!Range &&
				hasLvalueElements!Range && ... ;

	Range remove(SwapStrategy s, R)(...) if (fooConstraint!R) { ... }


T

-- 
"Maybe" is a strange word.  When mom or dad says it it means "yes", but when my big brothers say it it means "no"! -- PJ jr.


More information about the Digitalmars-d mailing list