On 5/24/18 8:08 AM, rikki cattermole wrote:
On 25/05/2018 12:06 AM, biocyberman wrote:
I am testing with DMD 2.078.2 locally. This tiny snippet works on dlang's online editor: https://run.dlang.io/is/nb4IV4

But it does not work on my local dmd.

import std.algorithm.mutation;
import std.stdio;
char[] arr = "hello\U00010143\u0100\U00010143".dup;
writeln(arr.reverse);

Error: template std.stdio.writeln cannot deduce function from argument types !()(void)

The document says reverse returns a range: https://dlang.org/phobos/std_algorithm_mutation.html#reverse

https://docarchives.dlang.io/v2.078.0/phobos/std_algorithm_mutation.html#reverse

This doesn't quite tell the whole story.

An array used to have a .reverse property that the compiler implemented, which returned the array after reversing it. So in history, this actually worked without std.algorithm.

You get a nice history of what happens using "all dmd versions" on run.dlang.io. If you remove the "mutation" part from the import, you get:

Up to      2.071.2: Success with output: ๐…ƒฤ€๐…ƒolleh
2.072.2 to 2.074.1: Success with output:
-----
onlineapp.d(6): Deprecation: use std.algorithm.reverse instead of .reverse property
๐…ƒฤ€๐…ƒolleh
-----

           2.075.1: Failure with output:
-----
onlineapp.d(6): Error: template std.stdio.writeln cannot deduce function from argument types !()(void), candidates are: /path/to/dmd.linux/dmd2/linux/bin64/../../src/phobos/std/stdio.d(3553): std.stdio.writeln(T...)(T args)
-----

2.076.1 to 2.077.1: Failure with output:
-----
onlineapp.d(6): Error: template std.stdio.writeln cannot deduce function from argument types !()(void), candidates are: /path/to/dmd.linux/dmd2/linux/bin64/../../src/phobos/std/stdio.d(3571): std.stdio.writeln(T...)(T args)
-----

           2.078.1: Failure with output:
-----
onlineapp.d(6): Error: template std.stdio.writeln cannot deduce function from argument types !()(void), candidates are: /path/to/dmd.linux/dmd2/linux/bin64/../../src/phobos/std/stdio.d(3657): std.stdio.writeln(T...)(T args)
-----

Since      2.079.0: Success with output: ๐…ƒฤ€๐…ƒolleh

-Steve

Reply via email to