digitalmars.D - optional parens everywhere except last position of function chain.
- timotheecour (22/22) Feb 27 2013 Here's yet another proposal regarding optional parens that makes
- Tove (3/4) Feb 27 2013 spontaneously... I love it!
- timotheecour (1/2) Feb 28 2013 is there any other spontaneous feedback?
Here's yet another proposal regarding optional parens that makes
a single simple rule to resolve ambiguities:
A symbol 'foo' that refers to a non- property-qualified function
or function template is rewritten to foo() iff it is followed by
a dot (".").
There's probably a better way to rephrase this in terms of AST,
but in other words, parens are optional inside a function
forwarding chain, but mandatory for the last element of the
function chain.
When a,b,c are non-property functions:
a.b.c(); => a().b().c(); // c is called
a.b.c; // c function not called
c(); => // c is called
c; => // c not called
typeof(c) => function type
typeof(c()) => return type
[1,2].sort.map!cos.array.sort.reduce!max.writeln();
=>[1,2].sort().map!cos().array().sort().reduce!max().writeln();
Advantages:
No complex special cases, it is unambiguous for both compiler and
user.
Please let me know what you think.
Feb 27 2013
On Wednesday, 27 February 2013 at 18:55:37 UTC, timotheecour wrote:Please let me know what you think.spontaneously... I love it!
Feb 27 2013
spontaneously... I love it!is there any other spontaneous feedback?
Feb 28 2013
On 2013-02-28 23:00, timotheecour wrote:Spontaneously... I hate it. :) I prefer optional parentheses everywhere.spontaneously... I love it!is there any other spontaneous feedback?
Feb 28 2013
On Thursday, 28 February 2013 at 22:00:22 UTC, timotheecour wrote:Love it as well.spontaneously... I love it!is there any other spontaneous feedback?
Feb 28 2013









FG <home fgda.pl> 