Copy Constructor DIP

Luís Marques luis at luismarques.eu
Thu Jul 12 14:56:33 UTC 2018


On Tuesday, 10 July 2018 at 10:47:04 UTC, RazvanN wrote:
> I managed to put together a first draft of the DIP for adding 
> the copy constructor to the language [1]. If anyone is 
> interested, please take a look. Suggestions and comments about 
> technical aspects and wording are all welcome.

When designing D libraries than lean towards DSL style, I've 
frequently felt impaired by the lack of implicit conversions in 
D. In my experience, it's not that all types need to be 
implicitly convertible to other types. Just being able to mark a 
few types as implicitly convertible to some other specific types 
would go a long way to alleviate the limitations I felt.  It 
would also solve problems like an arbitrary limit on the depth of 
implicit conversions.

I had imagined that maybe one day an implicit keyword could be 
introduced to mark such permissible implicit conversions. Seeing 
an implicit "keyword" being introduced here with different 
semantics than I envisioned makes me even less hopeful that some 
day such implicit conversions annotations could be introduced. 
So... maybe consider choosing some other syntactic notation? 
Besides, the fact that the compiler can implicitly introduce 
calls to the copy ctor doesn't strike me as something 
particularly central to the concept, so it seems like an odd 
choice for something to distinguish a copy ctor.



More information about the Digitalmars-d mailing list