need examples to understand postfix expression grammar

Ali Çehreli acehreli at yahoo.com
Wed Apr 19 20:26:07 UTC 2023


On 4/19/23 08:40, FabArd wrote:

 > assign a type to an auto variable:
[...]
 >     auto x = double();

A couple of perhaps-too-pedantic corrections:

1) "auto variable" is nothing special. D has type inference and 'auto' 
is just a place holder in your example. Otherwise, type inference is in 
effect anyway:

    auto a = double();
    const b = double();
    immutable c = double();
    shared d = double();
    static e = double();
    @nogc f = double();
    nothrow g = double();
    pure h = double();

2) The right hand side is not a type but an expression: double() is the 
construction of a double value of double.init.

Ali



More information about the Digitalmars-d mailing list