Can someone explain why this is not an error?

FeepingCreature default_357-line at yahoo.de
Thu Jul 1 06:12:49 PDT 2010


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 = true;
>     }
> ---
> 
> a, b, and c all have different types. Unless you consider the type as 
> 'type to be inferred'. Can anyone explain this behaviour to me?
> 

Type deduction is a special case. I think the above was written before we had it.


More information about the Digitalmars-d mailing list