Thread overview | ||||||
---|---|---|---|---|---|---|
|
May 24, 2018 return type of std.algorithm.mutation.reverse changed for good? | ||||
---|---|---|---|---|
| ||||
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 |
May 25, 2018 Re: return type of std.algorithm.mutation.reverse changed for good? | ||||
---|---|---|---|---|
| ||||
Posted in reply to biocyberman | 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 |
May 24, 2018 Re: return type of std.algorithm.mutation.reverse changed for good? | ||||
---|---|---|---|---|
| ||||
Posted in reply to rikki cattermole | 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 |
May 24, 2018 Re: return type of std.algorithm.mutation.reverse changed for good? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Steven Schveighoffer | On Thursday, 24 May 2018 at 12:34:38 UTC, Steven Schveighoffer wrote: > 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 @Rikki and Steve: Many thanks for the good tips. I upgraded to dmd.2.080.0 now, but the server seems to be very slow. It's another story anyway. % ./install.sh dmd !9767 Downloading and unpacking http://downloads.dlang.org/releases/2.x/2.080.0/dmd.2.080.0.linux.tar.xz curl: (28) Operation too slow. Less than 1024 bytes/sec transferred the last 30 seconds Failed to download 'http://downloads.dlang.org/releases/2.x/2.080.0/dmd.2.080.0.linux.tar.xz' |
Copyright © 1999-2021 by the D Language Foundation