August 10, 2022

On Tuesday, 9 August 2022 at 22:58:16 UTC, Paul Backus wrote:

>

On Tuesday, 9 August 2022 at 22:36:23 UTC, Dom Disc wrote:

>

On Tuesday, 9 August 2022 at 22:32:23 UTC, Dom Disc wrote:

>

On Tuesday, 9 August 2022 at 21:16:22 UTC, Paul Backus wrote:

>

Yes, this syntax allows anything that implicitly converts to BigInt;

Oh, or do you mean I will get two different instances of the template, if I call it with two different types with implicit conversion?
That would make it even worse than the non-templated declaration!

Yes, exactly.

Ok, then I consider this is a bug in Phobos that should be corrected.

All instances of

foo(T : fixedType)(T x) { }

should be replaced by

foo(fixedType x) { }
August 10, 2022

On Wednesday, 10 August 2022 at 06:15:39 UTC, Dom Disc wrote:

>

Ok, then I consider this is a bug in Phobos that should be corrected.

All instances of

foo(T : fixedType)(T x) { }

should be replaced by

foo(fixedType x) { }

Perhaps, but not necessarily. The body of foo could do introspection on T with static if or overloaded functions and produce specialised code. Even if foo doesn't do that, perhaps the author reserves the right to do that in future.

Or perhaps it needs to be a template to infer attributes. For that case, using an empty template parameter list would be clearer.

1 2
Next ›   Last »