Tell us your DIP1000 woes
Dukc
ajieskola at gmail.com
Mon Aug 26 13:46:26 UTC 2024
Mike Parker kirjoitti 25.8.2024 klo 16.10:
> DIP1000 keeps rearing its head in discussions touching on safety in our
> monthly meetings. So we recently held a planning session focused
> exclusively on DIP1000. Two things came out of it.
>
> First, it's pretty clear that inference by default is necessary to make
> DIP1000 easier to use. It's not clear at the moment how this can be
> achieved, but it's something that we need to work out.
>
> 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.
>
> If you've had problems using DIP1000, please post here with a
> description of what you encountered and any details about it you think
> we may find helpful. Please provide example code where possible.
>
> As an example of the sort of thing we're looking for, someone in the
> meeting brought up the problems encountered with trying to add DIP1000
> support to vibe.d.
>
> **Please do not reply to posts in this thread unless you have additional
> relevant information regarding the problem described.** We want to
> collect examples, and any side discussions will just be noise.
>
> Thanks!
>
>
That `scope` can get inferred to a local variable due to a LATER
assignment to it leads to pretty confusing situations. I think only the
initialisation should infer. I'm not sure if it's worth a change anymore
though, as it'll lead to more breakage. Maybe over an edition switch.
I still think `scope`/`return scope` inference should only happen on a
`@safe` function (whether explicitly safe or inferred as so). In
`@trusted` / `@system` code it is critical you don't have those
attributes added and removed under your nose or in an
implementation-defined manner. Yet it [can
happen](https://forum.dlang.org/post/edtbjavjzkwogvutxpho@forum.dlang.org).
Design by introspection also doesn't [fully work
with](https://issues.dlang.org/show_bug.cgi?id=24003) `scope` / `return
scope`, as I discovered when I tried to make a [Phobos function DIP1000
- compilant](https://issues.dlang.org/show_bug.cgi?id=23300). Dennis did
make a pull request to enable this but it stalled.
More information about the Digitalmars-d
mailing list