template syntax

Seb seb at wilzba.ch
Thu Jan 31 13:01:09 UTC 2019


On Thursday, 31 January 2019 at 01:28:29 UTC, H. S. Teoh wrote:
> On Wed, Jan 30, 2019 at 05:11:07PM -0800, Walter Bright via 
> Digitalmars-d wrote:
>> On 1/30/2019 4:08 PM, Andrei Alexandrescu wrote:
>> > Don't forget "typename" and "::template", beautifully 
>> > combined here:
>> > 
>> > typedef typename Allocator::template rebind<Mapped>::other 
>> > mapped_type_allocator;
>> 
>> It is indeed beautiful. Want to write a DIP to switch to < > ?
>
> I second!
>
> And while we're at it, how about reinstating the comma operator 
> and introducing opComma, and additionally opLess, opLessEqual, 
> opGreater, opGreaterEqual, opNotEqual, and opDot?  It will be 
> greatly helpful with a library implementation of < > syntax, 
> which will be an important step to gauge how useful it will be 
> in practice, and could in the meantime serve as a good 
> substitute in lieu of a complicated in-compiler implementation.
>
>
> T

FWIW opDot still exists in DMD as of 2.084.0 (and nightly):

https://github.com/dlang/dmd/blob/2457038c1ac37fbe1098b4b3d98007761149dfaf/test/runnable/xtest46.d#L130

It's just deprecated.
We don't have opGreater/opEqual, but there's still opAnd:

https://github.com/dlang/dmd/blob/06d3770d3baf51ce0b4b9998bf6a4e0369ee8f02/test/runnable/opover.d

In fact all these old D1 operator overloads (opPos,opNeg,..., 
opShl, opShr,..., opMul_r) are still supported in DMD and don't 
even trigger a deprecation message:

https://github.com/dlang/dmd/blob/06d3770d3baf51ce0b4b9998bf6a4e0369ee8f02/src/dmd/id.d#L206



More information about the Digitalmars-d mailing list