template syntax

Patrick Schluter Patrick.Schluter at bbox.fr
Wed Jan 30 20:46:06 UTC 2019


On Wednesday, 30 January 2019 at 19:17:38 UTC, dronord wrote:
> Hello!
>
> Thanks for best language syntax! But templates.
>
> Templates are traditional is {} or <>.
>
> !(exclamation mark) sense/perceive as stop symbol, by my mean.
>
> < and > is nice construction. May be add it in D?)
>
> Again, big thanks for language!

< and > used as brackets is completely brain dead. Here a little 
example in C++ showing why

fon< fun< 1 >>::three >::two >::one

what doas it mean? (i.e. how is it parsed).

Answer: it depends. It doesn't parse the same under C++98 or 
C++11.

fon< fun< 1 >>::three >::two >::one    // in C++98
           -----------
      -----------------------
-----------------------------------

and

fon< fun< 1 >>::three >::two >::one    // in C++11
      --------
---------------------
----------------------------
-----------------------------------

and to avoid this catastrophic parsing nightmare, D chose a 
syntax that is not ambiguous.

https://gustedt.wordpress.com/2013/12/18/right-angle-brackets-shifting-semantics/#more-2083


More information about the Digitalmars-d mailing list