Frist Draft (in this forum): Enum Parameters
    Paul Backus 
    snarwin at gmail.com
       
    Tue May  7 15:20:24 UTC 2024
    
    
  
On Tuesday, 7 May 2024 at 11:23:10 UTC, Quirin Schroll wrote:
> You’re right in that `forward` better be mentioned in the DIP. 
> Writing an answer to this post, I found out that not only could 
> `forward` easily be adapted to recognize `enum` parameters and 
> handle them properly by leaving them alone, `forward` actually 
> would handle them correctly today.
Good to know; thanks for looking into this.
However, the main issue here is not `forward`--it's that in order 
to write correct generic code with this feature in place, D 
programmers will forever be obliged to defensively write `auto 
enum auto ref` on any parameter they intend to forward (and will 
have to go back and add `auto enum` to many of their existing 
`auto ref` parameters).
Most D programmers already forget to add `auto ref` to such 
parameters (see for example the vast swathes of Phobos which fail 
to compile when used with non-copyable types). Adding an 
additional thing for them to forget is, like I said, setting them 
up for failure.
(Also, `auto enum auto ref` is quite ugly and "attribute spam"-y, 
and some programmers will no doubt leave it out of their code 
intentionally in order to make the code look nicer--as they 
already do with existing attributes and parameter storage 
classes.)
    
    
More information about the dip.development
mailing list