Yigal Chripun wrote:
also, some thought should be spent on getting rid of the ternary op syntax since it interferes with other things that could be added to the language (nullable types, for instance)

Heresy!

The ternary operator is one of my favorite tools. If you want to get rid of it, I think you'd have to make the 'if' statement into an expression (which would open up a whole other can of worms).

As I showed earlier, there's no ambiguity between the ternary operator and the nullable type suffix. The ambiguity comes from the case statement. In my opinion, the best way to resolve that ambiguity is to add braces around case statments, like this:

  switch (x) {
    case 1 { ... }
    case 2 { ... }
    default { ... }
  }

But that might make it impossible to implement Duff's Device (blessing or curse? personally, I don't care).

And it might imply the creation of a new scope with each case. Currently, a case statement doesn't introduce its own lexical scope.

Anyhoo... Don't mess with the ternary operator!!

:)

--benji

Reply via email to