On Sunday, 25 June 2017 at 15:46:12 UTC, Petar Kirov [ZombineDev] wrote:

out result => result > 0 // not much worse

out __result > 0 // even better (__result works at least since [0])

I suggested adding a shorter / better looking contextual keyword -
`result` - a while ago [1]:
---
out result > 0 // perhaps the best
---

I have no stance with having to specify a result identifier, or using __result, making `result` special, *but*: Not requiring parentheses here introduces an unacceptable language inconsistency:

auto x(T)(T t)
  if (...)
  in (...)
  out ...
{
    ...
}

If you also propose to drop the parentheses for `in`, that still leaves the inconsistency with `if`, i.e. now `if` must be changed to also drop the parentheses in template constraints. That, however, leads then to an inconsistency between different uses of `if` and thus all other occurrences of `if` in the grammar must now be made to work without parenthesis. This then leads to even more inconsistencies with `for`, `while`, etc. that now also will have to be changed.


I'm wondering if `out result > 0` (or if not `out __result > 0`)
would be too much of a stretch for the language grammar.


As argued above, it would essentially require making all uses of parenthesis for conditions optional or introduce atrocious inconsistencies. If this is to be done, I believe it belongs in a separate DIP "Optional parenthesis for conditions", while this DIP uses parentheses.

Reply via email to