Re: Code behaves incorrectly if it is compiled in std.functional

2015-06-09 Thread ketmar via Digitalmars-d
On Mon, 08 Jun 2015 15:30:24 +, Marc Schütz wrote: On Monday, 8 June 2015 at 15:09:21 UTC, ketmar wrote: On Mon, 08 Jun 2015 15:47:33 +0200, Timon Gehr wrote: On 06/08/2015 03:11 PM, ketmar wrote: so specifying two storage classes are sometimes valid and sometimes invalid. a perfect

Re: Code behaves incorrectly if it is compiled in std.functional

2015-06-09 Thread Timon Gehr via Digitalmars-d
On 06/09/2015 11:11 AM, ketmar wrote: On Mon, 08 Jun 2015 15:30:24 +, Marc Schütz wrote: On Monday, 8 June 2015 at 15:09:21 UTC, ketmar wrote: On Mon, 08 Jun 2015 15:47:33 +0200, Timon Gehr wrote: On 06/08/2015 03:11 PM, ketmar wrote: so specifying two storage classes are sometimes

Re: Code behaves incorrectly if it is compiled in std.functional

2015-06-09 Thread ketmar via Digitalmars-d
On Tue, 09 Jun 2015 13:09:22 +0200, Timon Gehr wrote: i'll keep citing `foreach (auto i)` thingy. it can't be deduced by using the knowledge of other language constructs, it can be only remembered. the less things one can't deduce language has, the better.

Re: Code behaves incorrectly if it is compiled in std.functional

2015-06-08 Thread ketmar via Digitalmars-d
On Sun, 07 Jun 2015 18:49:24 +0200, Timon Gehr wrote: On 06/06/2015 08:06 AM, ketmar wrote: On Sat, 06 Jun 2015 00:28:51 +0200, Timon Gehr wrote: On 06/05/2015 02:33 PM, ketmar wrote: i agree, i think it was a keyword used 'cause it was already used in C. but it's meaning is completely

Re: Code behaves incorrectly if it is compiled in std.functional

2015-06-08 Thread ketmar via Digitalmars-d
On Sun, 07 Jun 2015 18:50:07 +0200, Timon Gehr wrote: On 06/06/2015 08:10 AM, ketmar wrote: if `auto` can play a role of type placeholder There is no such thing as a type placeholder. there is: `immutable auto` -- ok `immutable const` -- not ok ergo, `auto` is not a storage class, but

Re: Code behaves incorrectly if it is compiled in std.functional

2015-06-08 Thread via Digitalmars-d
On Monday, 8 June 2015 at 09:33:56 UTC, ketmar wrote: On Mon, 08 Jun 2015 09:27:34 +, Marc Schütz wrote: ergo, `auto` is not a storage class, but type placeholder. No. and it's not a storage class too. `foreach (auto i; 0..42)` doesn't work, white `foreach (immutable i; 0..42)`

Re: Code behaves incorrectly if it is compiled in std.functional

2015-06-08 Thread Temtaime via Digitalmars-d
Auto was a storage class in C, but in D it's a type placeholder.

Re: Code behaves incorrectly if it is compiled in std.functional

2015-06-08 Thread ketmar via Digitalmars-d
On Mon, 08 Jun 2015 09:27:34 +, Marc Schütz wrote: ergo, `auto` is not a storage class, but type placeholder. No. and it's not a storage class too. `foreach (auto i; 0..42)` doesn't work, white `foreach (immutable i; 0..42)` works ok. signature.asc Description: PGP signature

Re: Code behaves incorrectly if it is compiled in std.functional

2015-06-08 Thread via Digitalmars-d
On Monday, 8 June 2015 at 07:30:06 UTC, ketmar wrote: On Sun, 07 Jun 2015 18:50:07 +0200, Timon Gehr wrote: On 06/06/2015 08:10 AM, ketmar wrote: if `auto` can play a role of type placeholder There is no such thing as a type placeholder. there is: `immutable auto` -- ok Allocate a

Re: Code behaves incorrectly if it is compiled in std.functional

2015-06-08 Thread Daniel Kozák via Digitalmars-d
On Mon, 08 Jun 2015 10:21:25 + Temtaime via Digitalmars-d digitalmars-d@puremagic.com wrote: Auto was a storage class in C, but in D it's a type placeholder. It is still a storage class in D too. http://dlang.org/grammar.html#StorageClasses

Re: Code behaves incorrectly if it is compiled in std.functional

2015-06-08 Thread Timon Gehr via Digitalmars-d
On 06/08/2015 03:11 PM, ketmar wrote: so specifying two storage classes are sometimes valid and sometimes invalid. a perfect consistency! The compiler sometimes compiles the program and sometimes terminates with an error message instead. That's life.

Re: Code behaves incorrectly if it is compiled in std.functional

2015-06-08 Thread Timon Gehr via Digitalmars-d
On 06/08/2015 03:12 PM, ketmar wrote: On Mon, 08 Jun 2015 13:38:08 +0200, Timon Gehr wrote: On 06/08/2015 09:30 AM, ketmar wrote: On Sun, 07 Jun 2015 18:50:07 +0200, Timon Gehr wrote: On 06/06/2015 08:10 AM, ketmar wrote: if `auto` can play a role of type placeholder There is no such

Re: Code behaves incorrectly if it is compiled in std.functional

2015-06-08 Thread Timon Gehr via Digitalmars-d
On 06/08/2015 03:17 PM, ketmar wrote: ... i tried to explain to some people why `foreach (i; 0..42)` doesn't reuse previously declared `i` and failed. The reason is that it wouldn't make any sense. it doesn't look like variable declaration at all, It looks like a variable declaration

Re: Code behaves incorrectly if it is compiled in std.functional

2015-06-08 Thread Timon Gehr via Digitalmars-d
On 06/08/2015 09:28 AM, ketmar wrote: On Sun, 07 Jun 2015 18:49:24 +0200, Timon Gehr wrote: On 06/06/2015 08:06 AM, ketmar wrote: On Sat, 06 Jun 2015 00:28:51 +0200, Timon Gehr wrote: On 06/05/2015 02:33 PM, ketmar wrote: i agree, i think it was a keyword used 'cause it was already used in

Re: Code behaves incorrectly if it is compiled in std.functional

2015-06-08 Thread ketmar via Digitalmars-d
On Mon, 08 Jun 2015 14:28:06 +0200, Timon Gehr wrote: On 06/08/2015 09:28 AM, ketmar wrote: On Sun, 07 Jun 2015 18:49:24 +0200, Timon Gehr wrote: On 06/06/2015 08:06 AM, ketmar wrote: On Sat, 06 Jun 2015 00:28:51 +0200, Timon Gehr wrote: On 06/05/2015 02:33 PM, ketmar wrote: i agree, i

Re: Code behaves incorrectly if it is compiled in std.functional

2015-06-08 Thread ketmar via Digitalmars-d
On Mon, 08 Jun 2015 13:38:08 +0200, Timon Gehr wrote: On 06/08/2015 09:30 AM, ketmar wrote: On Sun, 07 Jun 2015 18:50:07 +0200, Timon Gehr wrote: On 06/06/2015 08:10 AM, ketmar wrote: if `auto` can play a role of type placeholder There is no such thing as a type placeholder. there is:

Re: Code behaves incorrectly if it is compiled in std.functional

2015-06-08 Thread Timon Gehr via Digitalmars-d
On 06/08/2015 09:30 AM, ketmar wrote: On Sun, 07 Jun 2015 18:50:07 +0200, Timon Gehr wrote: On 06/06/2015 08:10 AM, ketmar wrote: if `auto` can play a role of type placeholder There is no such thing as a type placeholder. there is: `immutable auto` -- ok `immutable const` -- not ok

Re: Code behaves incorrectly if it is compiled in std.functional

2015-06-08 Thread Timon Gehr via Digitalmars-d
On 06/08/2015 11:33 AM, ketmar wrote: On Mon, 08 Jun 2015 09:27:34 +, Marc Schütz wrote: ergo, `auto` is not a storage class, but type placeholder. No. and it's not a storage class too. `foreach (auto i; 0..42)` doesn't work, white `foreach (immutable i; 0..42)` works ok.

Re: Code behaves incorrectly if it is compiled in std.functional

2015-06-08 Thread ketmar via Digitalmars-d
On Mon, 08 Jun 2015 13:47:09 +0200, Timon Gehr wrote: On 06/08/2015 11:33 AM, ketmar wrote: On Mon, 08 Jun 2015 09:27:34 +, Marc Schütz wrote: ergo, `auto` is not a storage class, but type placeholder. No. and it's not a storage class too. `foreach (auto i; 0..42)` doesn't work,

Re: Code behaves incorrectly if it is compiled in std.functional

2015-06-08 Thread ketmar via Digitalmars-d
On Mon, 08 Jun 2015 15:47:33 +0200, Timon Gehr wrote: On 06/08/2015 03:11 PM, ketmar wrote: so specifying two storage classes are sometimes valid and sometimes invalid. a perfect consistency! The compiler sometimes compiles the program and sometimes terminates with an error message

Re: Code behaves incorrectly if it is compiled in std.functional

2015-06-08 Thread ketmar via Digitalmars-d
On Mon, 08 Jun 2015 15:54:23 +0200, Timon Gehr wrote: On 06/08/2015 03:17 PM, ketmar wrote: ... i tried to explain to some people why `foreach (i; 0..42)` doesn't reuse previously declared `i` and failed. The reason is that it wouldn't make any sense. it doesn't look like variable

Re: Code behaves incorrectly if it is compiled in std.functional

2015-06-08 Thread ketmar via Digitalmars-d
On Mon, 08 Jun 2015 15:46:22 +0200, Timon Gehr wrote: It indicates to the parser that what follows is a declaration. Nothing more. It does not hold the place of anything else. so it's not a default storage type, but simply a mark for a parser. well, the third definition. signature.asc

Re: Code behaves incorrectly if it is compiled in std.functional

2015-06-08 Thread via Digitalmars-d
On Monday, 8 June 2015 at 15:09:21 UTC, ketmar wrote: On Mon, 08 Jun 2015 15:47:33 +0200, Timon Gehr wrote: On 06/08/2015 03:11 PM, ketmar wrote: so specifying two storage classes are sometimes valid and sometimes invalid. a perfect consistency! The compiler sometimes compiles the program

Re: Code behaves incorrectly if it is compiled in std.functional

2015-06-08 Thread Timon Gehr via Digitalmars-d
On 06/08/2015 05:15 PM, ketmar wrote: On Mon, 08 Jun 2015 15:46:22 +0200, Timon Gehr wrote: It indicates to the parser that what follows is a declaration. Nothing more. It does not hold the place of anything else. so it's not a default storage type, but simply a mark for a parser. well, the

Re: Code behaves incorrectly if it is compiled in std.functional

2015-06-07 Thread Timon Gehr via Digitalmars-d
On 06/06/2015 08:10 AM, ketmar wrote: if `auto` can play a role of type placeholder There is no such thing as a type placeholder.

Re: Code behaves incorrectly if it is compiled in std.functional

2015-06-07 Thread Timon Gehr via Digitalmars-d
On 06/06/2015 08:06 AM, ketmar wrote: On Sat, 06 Jun 2015 00:28:51 +0200, Timon Gehr wrote: On 06/05/2015 02:33 PM, ketmar wrote: i agree, i think it was a keyword used 'cause it was already used in C. but it's meaning is completely redefined in D. The meaning is exactly the same. It's the

Re: Code behaves incorrectly if it is compiled in std.functional

2015-06-07 Thread Artur Skawina via Digitalmars-d
On 06/07/15 18:49, Timon Gehr via Digitalmars-d wrote: This is valid C: int main(){ const auto int x=2; return 0; } This is not valid C: int main(){ auto auto int x=2; return 0; } What is the problem? The problem is the apparently common misunderstanding that 'auto'

Re: Code behaves incorrectly if it is compiled in std.functional

2015-06-07 Thread via Digitalmars-d
On Sunday, 7 June 2015 at 05:02:47 UTC, ketmar wrote: On Sat, 06 Jun 2015 18:49:00 +, Marc Schütz wrote: On Saturday, 6 June 2015 at 15:12:38 UTC, ketmar wrote: what should i check to see what is *really* allowed, why two storage classes allowed with one combination and not allowed with

Re: Code behaves incorrectly if it is compiled in std.functional

2015-06-06 Thread ketmar via Digitalmars-d
On Sat, 06 Jun 2015 00:28:51 +0200, Timon Gehr wrote: On 06/05/2015 02:33 PM, ketmar wrote: i agree, i think it was a keyword used 'cause it was already used in C. but it's meaning is completely redefined in D. The meaning is exactly the same. It's the default storage class. then i'll fill

Re: Code behaves incorrectly if it is compiled in std.functional

2015-06-06 Thread ketmar via Digitalmars-d
On Fri, 05 Jun 2015 18:35:49 +, Marc Schütz wrote: On Friday, 5 June 2015 at 17:50:55 UTC, ketmar wrote: `const int` works, so i can't see why `auto auto` is failing. Wrong analogy. Try `const const`, and it will fail with the same error as `auto auto`: redundant attribute. nope. in

Re: Code behaves incorrectly if it is compiled in std.functional

2015-06-06 Thread ketmar via Digitalmars-d
On Fri, 05 Jun 2015 20:36:19 +, Mafi wrote: On Friday, 5 June 2015 at 10:56:36 UTC, ketmar wrote: p.s. if auto is a storage class, the following code should be accepted (while it isn't): int foo () { return 42; } void main () { auto auto i = foo(); } as it's logically

Re: Code behaves incorrectly if it is compiled in std.functional

2015-06-06 Thread ketmar via Digitalmars-d
On Fri, 05 Jun 2015 20:36:19 +, Mafi wrote: On Friday, 5 June 2015 at 10:56:36 UTC, ketmar wrote: p.s. if auto is a storage class, the following code should be accepted (while it isn't): int foo () { return 42; } void main () { auto auto i = foo(); } as it's logically

Re: Code behaves incorrectly if it is compiled in std.functional

2015-06-06 Thread via Digitalmars-d
On Saturday, 6 June 2015 at 06:05:46 UTC, ketmar wrote: On Fri, 05 Jun 2015 18:35:49 +, Marc Schütz wrote: On Friday, 5 June 2015 at 17:50:55 UTC, ketmar wrote: `const int` works, so i can't see why `auto auto` is failing. Wrong analogy. Try `const const`, and it will fail with the

Re: Code behaves incorrectly if it is compiled in std.functional

2015-06-06 Thread ketmar via Digitalmars-d
On Sat, 06 Jun 2015 12:36:09 +, Marc Schütz wrote: `const auto` isn't contradictory. It's simply two storage classes, one of which is the default. but it is! ok, how about `shared auto i = 42;`? what the $#^# `auto` means here? what is that default storage class then, and why it doesn't

Re: Code behaves incorrectly if it is compiled in std.functional

2015-06-06 Thread ketmar via Digitalmars-d
On Sat, 06 Jun 2015 18:49:00 +, Marc Schütz wrote: On Saturday, 6 June 2015 at 15:12:38 UTC, ketmar wrote: what should i check to see what is *really* allowed, why two storage classes allowed with one combination and not allowed with another? Well, you can look at the compiler's

Re: Code behaves incorrectly if it is compiled in std.functional

2015-06-06 Thread via Digitalmars-d
On Saturday, 6 June 2015 at 15:12:38 UTC, ketmar wrote: what should i check to see what is *really* allowed, why two storage classes allowed with one combination and not allowed with another? Well, you can look at the compiler's source... But I'm sure this is not the answer you wanted ;-)

Re: Code behaves incorrectly if it is compiled in std.functional

2015-06-05 Thread ketmar via Digitalmars-d
On Fri, 05 Jun 2015 09:44:09 +, Marc Schütz wrote: On Friday, 5 June 2015 at 04:39:28 UTC, ketmar wrote: On Fri, 05 Jun 2015 03:56:05 +, anonymous wrote: On Friday, 5 June 2015 at 03:45:18 UTC, ketmar wrote: `auto int a`?! it shouldn't be accepted at all! Yeah, but it's the same

Re: Code behaves incorrectly if it is compiled in std.functional

2015-06-05 Thread Meta via Digitalmars-d
On Friday, 5 June 2015 at 03:15:46 UTC, anonymous wrote: On Friday, 5 June 2015 at 02:38:39 UTC, ketmar wrote: here's dustmited source: Further reduced: void unaryFun()(auto int a) pure nothrow @safe @nogc {} alias Identity(F) = F; void main() { unaryFun!()(41); static void fun(int n)

Re: Code behaves incorrectly if it is compiled in std.functional

2015-06-05 Thread via Digitalmars-d
On Friday, 5 June 2015 at 10:54:36 UTC, ketmar wrote: On Fri, 05 Jun 2015 09:44:09 +, Marc Schütz wrote: On Friday, 5 June 2015 at 04:39:28 UTC, ketmar wrote: On Fri, 05 Jun 2015 03:56:05 +, anonymous wrote: On Friday, 5 June 2015 at 03:45:18 UTC, ketmar wrote: `auto int a`?! it

Re: Code behaves incorrectly if it is compiled in std.functional

2015-06-05 Thread via Digitalmars-d
On Friday, 5 June 2015 at 04:39:28 UTC, ketmar wrote: On Fri, 05 Jun 2015 03:56:05 +, anonymous wrote: On Friday, 5 June 2015 at 03:45:18 UTC, ketmar wrote: `auto int a`?! it shouldn't be accepted at all! Yeah, but it's the same with auto ref. `auto ref` has a well-defined meaning.

Re: Code behaves incorrectly if it is compiled in std.functional

2015-06-05 Thread ketmar via Digitalmars-d
On Fri, 05 Jun 2015 11:53:29 +, Marc Schütz wrote: My understanding is that `auto` is just C legacy, and originally had the same meaning as in C. But apparently the language has moved away from that over time. i agree, i think it was a keyword used 'cause it was already used in C. but

Re: Code behaves incorrectly if it is compiled in std.functional

2015-06-05 Thread ketmar via Digitalmars-d
On Fri, 05 Jun 2015 11:07:19 +, Meta wrote: On Friday, 5 June 2015 at 03:15:46 UTC, anonymous wrote: On Friday, 5 June 2015 at 02:38:39 UTC, ketmar wrote: here's dustmited source: Further reduced: void unaryFun()(auto int a) pure nothrow @safe @nogc {} alias Identity(F) = F; void

Re: Code behaves incorrectly if it is compiled in std.functional

2015-06-05 Thread via Digitalmars-d
On Friday, 5 June 2015 at 17:50:55 UTC, ketmar wrote: `const int` works, so i can't see why `auto auto` is failing. Wrong analogy. Try `const const`, and it will fail with the same error as `auto auto`: redundant attribute.

Re: Code behaves incorrectly if it is compiled in std.functional

2015-06-05 Thread ketmar via Digitalmars-d
On Fri, 05 Jun 2015 16:42:25 +, Mafi wrote: On Friday, 5 June 2015 at 16:26:34 UTC, ketmar wrote: On Fri, 05 Jun 2015 15:17:50 +, Mafi wrote: auto int x = 10; should work. It's just consistent. then `auto auto` should work too. it's a declaration mark + storage class. Well,

Re: Code behaves incorrectly if it is compiled in std.functional

2015-06-05 Thread Meta via Digitalmars-d
On Friday, 5 June 2015 at 12:32:03 UTC, ketmar wrote: but it does! both with 2.067.1 downloaded from dlang.org and with git HEAD. it may not do what you expect it to do (i don't know what it should do anyway), but dmd happily accepts that code. Hmm, maybe I'm only on 2.070 then. I'll upgrade

Re: Code behaves incorrectly if it is compiled in std.functional

2015-06-05 Thread ketmar via Digitalmars-d
On Fri, 05 Jun 2015 15:17:50 +, Mafi wrote: auto int x = 10; should work. It's just consistent. then `auto auto` should work too. it's a declaration mark + storage class. signature.asc Description: PGP signature

Re: Code behaves incorrectly if it is compiled in std.functional

2015-06-05 Thread Mafi via Digitalmars-d
On Friday, 5 June 2015 at 16:26:34 UTC, ketmar wrote: On Fri, 05 Jun 2015 15:17:50 +, Mafi wrote: auto int x = 10; should work. It's just consistent. then `auto auto` should work too. it's a declaration mark + storage class. Well, no. Any storage class marks a declaration just by

Re: Code behaves incorrectly if it is compiled in std.functional

2015-06-05 Thread ketmar via Digitalmars-d
On Fri, 05 Jun 2015 09:44:09 +, Marc Schütz wrote: On Friday, 5 June 2015 at 04:39:28 UTC, ketmar wrote: On Fri, 05 Jun 2015 03:56:05 +, anonymous wrote: On Friday, 5 June 2015 at 03:45:18 UTC, ketmar wrote: `auto int a`?! it shouldn't be accepted at all! Yeah, but it's the same

Re: Code behaves incorrectly if it is compiled in std.functional

2015-06-05 Thread Mafi via Digitalmars-d
On Friday, 5 June 2015 at 12:33:35 UTC, ketmar wrote: On Fri, 05 Jun 2015 11:53:29 +, Marc Schütz wrote: My understanding is that `auto` is just C legacy, and originally had the same meaning as in C. But apparently the language has moved away from that over time. i agree, i think it

Re: Code behaves incorrectly if it is compiled in std.functional

2015-06-05 Thread Adam D. Ruppe via Digitalmars-d
On Friday, 5 June 2015 at 19:45:18 UTC, krzaq wrote: const auto ans = 42; compiles fine for me, so auto clearly can be used as a type. So does auto immutable or auto pure or pure a. They're all storage classes and any storage class can kick off a declaration: @nogc a = 10; //

Re: Code behaves incorrectly if it is compiled in std.functional

2015-06-05 Thread Meta via Digitalmars-d
On Friday, 5 June 2015 at 19:38:06 UTC, Steven Schveighoffer wrote: On 6/5/15 12:19 PM, Meta wrote: On Friday, 5 June 2015 at 12:32:03 UTC, ketmar wrote: but it does! both with 2.067.1 downloaded from dlang.org and with git HEAD. it may not do what you expect it to do (i don't know what it

Re: Code behaves incorrectly if it is compiled in std.functional

2015-06-05 Thread anonymous via Digitalmars-d
On Friday, 5 June 2015 at 03:15:46 UTC, anonymous wrote: On Friday, 5 June 2015 at 02:38:39 UTC, ketmar wrote: here's dustmited source: Further reduced: void unaryFun()(auto int a) pure nothrow @safe @nogc {} alias Identity(F) = F; void main() { unaryFun!()(41); static void fun(int n)

Re: Code behaves incorrectly if it is compiled in std.functional

2015-06-05 Thread Steven Schveighoffer via Digitalmars-d
On 6/5/15 12:19 PM, Meta wrote: On Friday, 5 June 2015 at 12:32:03 UTC, ketmar wrote: but it does! both with 2.067.1 downloaded from dlang.org and with git HEAD. it may not do what you expect it to do (i don't know what it should do anyway), but dmd happily accepts that code. Hmm, maybe I'm

Re: Code behaves incorrectly if it is compiled in std.functional

2015-06-05 Thread krzaq via Digitalmars-d
On Friday, 5 June 2015 at 18:35:51 UTC, Marc Schütz wrote: On Friday, 5 June 2015 at 17:50:55 UTC, ketmar wrote: `const int` works, so i can't see why `auto auto` is failing. Wrong analogy. Try `const const`, and it will fail with the same error as `auto auto`: redundant attribute. const

Re: Code behaves incorrectly if it is compiled in std.functional

2015-06-05 Thread Mafi via Digitalmars-d
On Friday, 5 June 2015 at 10:56:36 UTC, ketmar wrote: p.s. if auto is a storage class, the following code should be accepted (while it isn't): int foo () { return 42; } void main () { auto auto i = foo(); } as it's logically an auto-typed var with auto storage class. Here lies

Re: Code behaves incorrectly if it is compiled in std.functional

2015-06-05 Thread Timon Gehr via Digitalmars-d
On 06/05/2015 02:33 PM, ketmar wrote: i agree, i think it was a keyword used 'cause it was already used in C. but it's meaning is completely redefined in D. The meaning is exactly the same. It's the default storage class.

Re: Code behaves incorrectly if it is compiled in std.functional

2015-06-04 Thread krzaq via Digitalmars-d
I reproduced this bug on my arch linux with DMD 2.067 and git phobos (4cea8f1e4dd839568cc9e581bc15ee84f02e7135)

Re: Code behaves incorrectly if it is compiled in std.functional

2015-06-04 Thread anonymous via Digitalmars-d
On Friday, 5 June 2015 at 02:38:39 UTC, ketmar wrote: here's dustmited source: Further reduced: void unaryFun()(auto int a) pure nothrow @safe @nogc {} alias Identity(F) = F; void main() { unaryFun!()(41); static void fun(int n) pure nothrow @safe @nogc {} alias F = typeof(fun);

Code behaves incorrectly if it is compiled in std.functional

2015-06-04 Thread Meta via Digitalmars-d
This is so completely bizarre that I thought I was going crazy at first, but the same behaviour is exhibited whether I'm using my own copy of std.functional or a copy cloned straight from phobos master. The following code snippet exhibits different behaviour when it is put in a standalone file

Re: Code behaves incorrectly if it is compiled in std.functional

2015-06-04 Thread ketmar via Digitalmars-d
On Fri, 05 Jun 2015 03:15:45 +, anonymous wrote: On Friday, 5 June 2015 at 02:38:39 UTC, ketmar wrote: here's dustmited source: Further reduced: void unaryFun()(auto int a) pure nothrow @safe @nogc {} alias Identity(F) = F; void main() { unaryFun!()(41); static void fun(int

Re: Code behaves incorrectly if it is compiled in std.functional

2015-06-04 Thread ketmar via Digitalmars-d
here's dustmited source: template unaryFun(alias fun, string parmName=a) { static if (is(typeof(fun))) auto unaryFun(ElementType) (auto ElementType __a) { mixin(alias ~ parmName ~ = __a ;); return mixin(fun); } else static if (needOpCallAlias) { unaryFun fun; }

Re: Code behaves incorrectly if it is compiled in std.functional

2015-06-04 Thread anonymous via Digitalmars-d
On Friday, 5 June 2015 at 03:45:18 UTC, ketmar wrote: `auto int a`?! it shouldn't be accepted at all! Yeah, but it's the same with auto ref.

Re: Code behaves incorrectly if it is compiled in std.functional

2015-06-04 Thread ketmar via Digitalmars-d
On Fri, 05 Jun 2015 03:56:05 +, anonymous wrote: On Friday, 5 June 2015 at 03:45:18 UTC, ketmar wrote: `auto int a`?! it shouldn't be accepted at all! Yeah, but it's the same with auto ref. `auto ref` has a well-defined meaning. yet `auto int` is nonsence. it's definitely a compiler

Re: Code behaves incorrectly if it is compiled in std.functional

2015-06-04 Thread ketmar via Digitalmars-d
On Fri, 05 Jun 2015 04:39:28 +, ketmar wrote: On Fri, 05 Jun 2015 03:56:05 +, anonymous wrote: On Friday, 5 June 2015 at 03:45:18 UTC, ketmar wrote: `auto int a`?! it shouldn't be accepted at all! Yeah, but it's the same with auto ref. `auto ref` has a well-defined meaning. yet