Andrei Alexandrescu wrote:
Justin Johansson wrote:
Andrei Alexandrescu wrote:
Steven Schveighoffer wrote:
On Fri, 29 Jan 2010 11:21:28 -0500, Andrei Alexandrescu
<seewebsiteforem...@erdani.org> wrote:
How is f.byLine clearer and less ambiguous than f.byLine()? Or vice
versa for that matter?
Note that properties can be named things other than byLine.
-Steve
What I meant to say is that in the @property landscape the following
two conventions become suddenly attractive:
* Do not use @property at all
* Use @property for all nullary functions
And they're bound to save a lot of time to everyone involved.
Andrei
Unless you assume no global state, nullary functions are just
a figment of your imagination.
Huh? What? Is there an extra "no"?
Andrei
No, correct as I meant it. Confusion arises depending on whether you
have a syntactic or semantic definition of "nullary" and / or FP or
non-FP viewpoint.
Some would argue that a simple writeln() function is a nullary function.
Syntactically it is but there is a hidden argument, namely stdout. So
writeln() is semantically non-nullary and may even be thought
of as being declared by way of a macro expanded as
fwriteln( FILE* fp = stdout).
So unless the assumption is that there is no global state (including
stdout in this case), thinking of writeln() as a nullary function is
just a figment of one's imagination (imho) :-) It's a unary function
with a default argument = stdout !
In the general case of a function, foo, taking N arguments where each
argument is declared with a default value, e.g.
foo( int a1 = 3, int a2 = 5, .. int aN = whatever), then called using
all defaults as by foo(), or even just foo if optional dropping () is
allowed, would people still argue that foo() with all default args
is a nullary function?
Just my two cents on nullary.
-- Justin