dropping parentheses on template instantiation

Christopher Wright dhasenan at gmail.com
Wed Oct 8 16:26:51 PDT 2008


Leandro Lucarella wrote:
> downs, el  6 de octubre a las 17:28 me escribiste:
>>> auto v = new Vector with Stack with Tuple with (Positive with real,
>>> Matrix with real (3, 3)) ?
>> auto v = new Vector of Stack of (Positive of real, Matrix of (real, 3, 3));
>>
>> Probably suboptimal. I mostly just threw that out there as a "wouldn't it be cool" to remind people that there are alternatives besides foo[SYMBOL](bar, baz)
> 
> And I don't think:
> auto v = new Vector.(Stack.(Tuple.(Positive.(real), Matrix.(real))))(3, 3))

I can read this.

> auto v = new Vector{Stack{Tuple{Positive{real}, Matrix{real}}}}(3, 3))

I can read this.

> auto v = new Vector at Stack@Tuple@(Positive at real, Matrix at real)(3, 3))

This takes more effort to read.

auto v = new Vector @ Stack @ Tuple @ (Positive @ real, Matrix @ 
real)(3, 3))

I can start reading that.

auto v = new Vector @ (Stack @ (Tuple @ (Positive @ real, Matrix @ 
real)(3, 3))))

I can read this, but it's still not great.

> Is particulary nice either. You should use alias when nesting too deep,
> I guess.

Wholehearted agreement.



More information about the Digitalmars-d mailing list