On 6/23/16 7:46 PM, deadalnix wrote:
On Thursday, 23 June 2016 at 23:16:23 UTC, Steven Schveighoffer wrote:
This is a problem with optional (), not text.

A valid point. But we aren't going to have this change.


Spreading the shit doesn't make it smell good.

I once cared a lot about making parentheses required for non-@property functions that take no args. I'm not so keen on it any more, it doesn't add a lot of clarity in cases of no-arg functions.

The one thing that can be said here is that text is a terrible name for a function, since it's a likely name for a variable as well. asText or toText would have been better.

It's not a special case to require a minimum number of parameters.


You are just pushing the problem up one level. Now every template that
call text with a sequence need to do a length check (and none will).

And likely if they do happen to send zero args to text, it was a bug in the first place (and they should have been checking the length).

Also, you don't have to do much to work around:

foo(T...)(T args) {
text("", args);
}

The very problem is that the optional () make the argumentless thing a
special case. Special cases are like cancer, they spread. Making more
argumentless thing special cases is just making the problem worse.

The cases where you are going to call text with an unknown quantity of parameters is pretty small. I think they can deal with it. The fact that meta's PR caused zero breakage should tell you something.

-Steve

Reply via email to