On Thursday, 7 April 2022 at 12:52:20 UTC, MoonlightSentinel wrote:
> On Wednesday, 6 April 2022 at 20:27:10 UTC, kdevel wrote:
> Does it feel wrong to you, too?
Yes. I've changed to hint s.t. it suggests the string version. PR
Commendable, but my question related to the implementation
template octal(alias decimalInteger)
if (is(typeof(decimalInteger)) && isIntegral!(typeof(decimalInteger)))
{
enum octal = octal!(typeof(decimalInteger))(to!string(decimalInteger));
}
For this code I can hardly imagine an enhancement in order to cover decimalInteger > ulong.max. There is also a naming issue: Do we name parameters after their representation (decimal) or after their function (octal)? A better name is probably octalLiteralDisguisedAsDecimalLiteral
.
The documentation [1], [2] does not explicitly mention the inherent limitation of the quoteless conversion. The two forms octal!<literal>
and octal!<literal>"
are treated as interchangeable. In [3] we read
- C-style octal integer notation was deemed too easy to mix up with decimal notation; it is only fully supported in string literals. D still supports octal integer literals interpreted at compile time through the std.conv.octal template, as in octal!167.
There is no mention of any restriction of the argument domain at all.
TL;DR: Deprecate and remove template octal(alias decimalInteger).
[1] https://dlang.org/library/std/conv/octal.html
[2] https://dlang.org/phobos/std_conv.html#octal
[3] https://dlang.org/spec/lex.html#integerliteral