Re: Can someone explain why this is not an error?

2010-07-01 Thread Adam Ruppe
I don't think this is really a special case: they are all sharing the same keywords. immutable a = 1, b = "a"; // both a and b are immutable string a = "a", b = "b"; // both a and b are strings immutable int a = 1, b = 2; // both a and b are immutable ints I'd say the bug is that the documentatio

Re: Can someone explain why this is not an error?

2010-07-01 Thread Adam Ruppe
On 7/1/10, Adam Ruppe wrote: > (and auto, which is inferred from the missing type). Nitpicking myself, but I shouldn't have said that; auto is just the default storage class, and it is the missing type that means infer it, not the auto keyword. I think you know what I mean though.

Re: Can someone explain why this is not an error?

2010-07-01 Thread bearophile
FeepingCreature: > Type deduction is a special case. I think the above was written before we had > it. OK. Special cases in a language are often bad, and I don't think that syntax is significantly handy. So if you agree Bernard Helyer can put it in bugzilla, asking to remove this special case:

Re: Can someone explain why this is not an error?

2010-07-01 Thread canalpay
I think : Ýmmutable, type automatic moments. Because, it is StorageClass. Example : import std.stdio; void main() { immutable a = 3, b = 4.2, c = true; writeln(typeof(a).stringof,typeof(b).stringof,typeof(c).stringof); } or import std.stdio; void main() { auto a = 3, b = 4.2, c = t

Re: Can someone explain why this is not an error?

2010-07-01 Thread FeepingCreature
On 01.07.2010 11:49, Bernard Helyer wrote: > http://www.digitalmars.com/d/2.0/declaration.html > > "In a declaration declaring multiple symbols, all the declarations must > be of the same type:" > > Yet this compiles: > > --- > void main() > { > immutable a = 3, b = 4.2, c = tru

Re: Can someone explain why this is not an error?

2010-07-01 Thread Bernard Helyer
On Thu, 01 Jul 2010 06:26:34 -0400, dolive wrote: > immutable int a = 3, b = 4.2, c = true; // is error Uhhh, yes. Yes it is. ?_?

Re: Can someone explain why this is not an error?

2010-07-01 Thread dolive
Bernard Helyer дµ½: > http://www.digitalmars.com/d/2.0/declaration.html > > "In a declaration declaring multiple symbols, all the declarations must > be of the same type:" > > Yet this compiles: > > --- > void main() > { > immutable a = 3, b = 4.2, c = true; > } > --- > >

Can someone explain why this is not an error?

2010-07-01 Thread Bernard Helyer
http://www.digitalmars.com/d/2.0/declaration.html "In a declaration declaring multiple symbols, all the declarations must be of the same type:" Yet this compiles: --- void main() { immutable a = 3, b = 4.2, c = true; } --- a, b, and c all have different types. Unless you co