dip1000 and preview in combine to cause extra safety errors
Dukc
ajieskola at gmail.com
Wed Jun 15 10:49:13 UTC 2022
On Tuesday, 14 June 2022 at 23:51:45 UTC, Adam Ruppe wrote:
> On Tuesday, 14 June 2022 at 23:41:55 UTC, Walter Bright wrote:
>> Even with a linker error there'd be constant maintenance
>> problem for the user.
>
> What maintenance problem?
>
> When a library changes, it recompiles and generates its new
> interface file (if it even uses interface files; they're
> extremely rare in real world D code).
>
> If the library hasn't changed, there's no need to update
> anything, inference or not.
>
> This is near zero work.
I'm assuming you're arguing for an always-on function attribute
inference, at least for `scope` and `return scope`. Please no!
This would be outright poison for a stable API or ABI of a
library, probably including ARSD. All your public functions have
attributes added to them under your nose, and then you cannot
change them without breaking client code because it depends on
those attributes you did not intend to add.
Even in a top-level application it happens every now and then
that I intentionally want to disable some attributes from a
function. Maybe to hunt for some bug, maybe for DBI or testing
purposes. Now I can do that with `void nonScopeArgument(int*){}`.
With universal inference I'd have to resort to error-prone hacks
like
```D
void nonScopeArgument(int* arg)
{ static int* dummy;
if(false) dummy = arg;
}
```
. No thanks.
More information about the Digitalmars-d
mailing list