Tell us your DIP1000 woes
IchorDev
zxinsworld at gmail.com
Thu Aug 29 21:30:31 UTC 2024
On Sunday, 25 August 2024 at 13:10:22 UTC, Mike Parker wrote:
> Second, we'd like to get a number of examples of problems
> people have had with using DIP1000 that haven't shown up in
> Bugzilla. Walter wants to be as certain as he can whether such
> issues are fixable or if the design is fundamentally flawed.
A problem I’ve often encountered with the design of DIP1000 is
that factory functions returning `scope` variables isn’t really
possible. I often want to construct something in a function and
then return it, which allows me to make my code more modular.
Technically you can do this with a `ref` parameter, but then you
have to always remember to create the variable and then populate
it with the factory function… and then I remember that I can just
turn DIP1000 off, so I do. It’s great that I *could* put a class
instance on the stack with `scope`, but I don’t want to deal with
not even being able to return it.
In short, my experience with DIP1000 `scope` is like if `pure`
was upgraded to the final boss of D; declaring ‘thou shalt write
a program that never returns anything!’
More information about the Digitalmars-d
mailing list