Proposed Enhancement: Deprecate std.conv.text With 0 Arguments
Meta via Digitalmars-d
digitalmars-d at puremagic.com
Wed Jun 22 10:04:54 PDT 2016
On Wednesday, 22 June 2016 at 16:47:53 UTC, Jack Stouffer wrote:
> On Wednesday, 22 June 2016 at 15:48:06 UTC, Seb wrote:
>> I don't see any problem in deprecating it as std.conv.text
>> with 0 arguments is clearly unintended behavior
>
> I don't see how you can make that claim, take a look at the
> code again:
>
> private S textImpl(S, U...)(U args)
> {
> static if (U.length == 0)
> {
> return null;
> }
> else
> {
> auto result = to!S(args[0]);
> foreach (arg; args[1 .. $])
> result ~= to!S(arg);
> return result;
> }
> }
>
> The zero argument result was clearly an intentional special case
Intentional or not, I don't see any downside to disallowing
calling text with 0 args (aside from backwards-compatibility
concerns). It doesn't even return anything useful, just null.
More information about the Digitalmars-d
mailing list