Printing shortest decimal form of floating point number with Mir
John Colvin
john.loughran.colvin at gmail.com
Mon Jan 4 12:35:12 UTC 2021
On Monday, 4 January 2021 at 09:21:02 UTC, Ola Fosheim Grøstad
wrote:
> On Monday, 4 January 2021 at 09:18:50 UTC, Ola Fosheim Grøstad
> wrote:
>> On Monday, 4 January 2021 at 05:55:37 UTC, Ola Fosheim Grostad
>> wrote:
>>> On Monday, 4 January 2021 at 04:37:22 UTC, 9il wrote:
>>>> I suppose the answer would be that D doesn't pretend to
>>>> support all C++ template features and the bug is not a bug
>>>> because we live with this somehow for years.
>>>
>>> But it is a bug even if there was no C++... An alias should
>>> work by simple substitution, if it does not, then it is no
>>> alias...
>>
>> Here is an even simpler example that does not work:
>>
>> struct Foo(T){}
>> void foo(T)(T!int x) {}
>>
>> alias FooInt = Foo!int;
>>
>> void main() {
>> foo(FooInt());
>> }
>
> Oh, now wait, it does:
>
> struct Foo(T){}
> void foo(alias T)(T!int x) {}
> alias FooInt = Foo!int;
>
> void main() {
> foo(FooInt());
> }
>
> My mistake.
What's the simplest example that doesn't work and is that simple
example just indirection through an alias or is it actually
indirection through a template that *when instantiated* turns out
to be just an alias?
I have a suspicion that what you're asking for here is the
type-inference to have x-ray vision in to uninstantiated
templates that works for a few simple cases. Am I wrong?
To be clear, a really useful special case can be really useful
and worthwhile, but I'm not convinced this is the principled
"type system bug" you are saying it is.
More information about the Digitalmars-d-announce
mailing list