digitalmars.D - Changing the behavior of compile time ? :
- Jari-Matti =?ISO-8859-1?Q?M=E4kel=E4?= (12/12) May 08 2007 One thing that has been bugging me for a while is that the behavior of t...
One thing that has been bugging me for a while is that the behavior of the ternary ? : operator. On runtime auto foo = c() ? a() : b(); first evaluates c(), then only either a() or b(), not both of them. But, on compile time they are all evaluated. I'm aware that some template code depends on the behavior of ? : to deduce the proper type of the expression, but does it always require evaluation of both branches? Could it just deduce the type without instantiating templates etc. ? Changing this would make the template code readable in many places (static if's and helper templates could be converted to a one liner), and the old behavior could be simulated in many cases with helper variables.
May 08 2007