Feedback Thread: DIP 1043--Shortened Method Syntax--Community Review Round 1

Basile B. b2.temp at gmx.com
Sat Feb 5 12:40:04 UTC 2022


On Friday, 4 February 2022 at 10:57:17 UTC, Mike Parker wrote:
> ## Feedback Thread
>
> This is the feedback thread for the first round of Community 
> Review of DIP 1043, "Shortened Method Syntax".

It was discovered in the discussion thread that the fact that 
shorthand syntax is done at parse-time, on a 
`FunctionDeclaration`, causes problem with constructors (and 
possibly destructors). D AST defines different classes for 
destructors and constructors (`CtorDeclaration` and 
`DtorDeclaration`). Special processing are done or those two 
kinds of declarations, during semantic checks, notably the 
handling of constructor returns.

In those two cases, the shorthand syntax should either

-  create a `CtorDeclaration` or a `DtorDeclaration` properly, 
which is not done by the current preview implementation, hence 
the special lowerings, relying on `isCtorDeclaration()` cant 
work. In that case the DIP document does not require an update, 
just the implementation.

- be an error if the function used is a ctor or a dtor. In that 
case the document needs to be updated so that official specs can 
be exact, in case the DIP is accepted.


More information about the Digitalmars-d mailing list