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
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
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.
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
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
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)`
Auto was a storage class in C, but in D it's a type placeholder.
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
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
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
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.
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
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
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
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
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:
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
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.
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,
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
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
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
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
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
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.
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
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'
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
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
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
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
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
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
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
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
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 ;-)
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
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)
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
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.
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
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
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.
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,
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
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
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
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
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
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; //
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
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)
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
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
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
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.
I reproduced this bug on my arch linux with DMD 2.067 and git
phobos (4cea8f1e4dd839568cc9e581bc15ee84f02e7135)
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);
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
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
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;
}
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.
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
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
64 matches
Mail list logo