Jump to page: 1 2
Thread overview
@safe D requires which DIP switches?
Jan 03, 2022
Bastiaan Veelo
Jan 03, 2022
12345swordy
Jan 03, 2022
Bastiaan Veelo
Jan 03, 2022
Paul Backus
Jan 04, 2022
Dennis
Jan 04, 2022
Bastiaan Veelo
Jan 05, 2022
Atila Neves
Jan 05, 2022
Dennis
Jan 07, 2022
Atila Neves
Jan 07, 2022
bauss
Jan 07, 2022
Dennis
Jan 08, 2022
Elronnd
Jan 08, 2022
Nick Treleaven
Jan 08, 2022
Nick Treleaven
Jan 07, 2022
Dennis
Jan 08, 2022
Dukc
Jan 08, 2022
Dennis
Jan 03, 2022
ag0aep6g
Jan 04, 2022
Atila Neves
Jan 04, 2022
Bastiaan Veelo
January 03, 2022

As far as I know @safe is only really safe with both DIP25 and DIP1000 in effect, and I thought that DIP25 has been integrated for a while now. Nonetheless, DIP25 still appears in the list of previews (dmd -preview=help) as well as being revertible (dmd -revert=help) which adds to the confusion.

What is in the way of integrating DIP1000 by default?

-- Bastiaan.

January 03, 2022

On Monday, 3 January 2022 at 14:27:55 UTC, Bastiaan Veelo wrote:

>

As far as I know @safe is only really safe with both DIP25 and DIP1000 in effect, and I thought that DIP25 has been integrated for a while now. Nonetheless, DIP25 still appears in the list of previews (dmd -preview=help) as well as being revertible (dmd -revert=help) which adds to the confusion.

What is in the way of integrating DIP1000 by default?

-- Bastiaan.

Bugs, and lots of them.

  • Alex
January 03, 2022

On Monday, 3 January 2022 at 15:19:22 UTC, 12345swordy wrote:

>

On Monday, 3 January 2022 at 14:27:55 UTC, Bastiaan Veelo wrote:

>

As far as I know @safe is only really safe with both DIP25 and DIP1000 in effect, and I thought that DIP25 has been integrated for a while now. Nonetheless, DIP25 still appears in the list of previews (dmd -preview=help) as well as being revertible (dmd -revert=help) which adds to the confusion.

What is in the way of integrating DIP1000 by default?

-- Bastiaan.

Bugs, and lots of them.

  • Alex

But are these bugs in the rigidity of the checks, or do other problems arise when DIP1000 is enabled? If it is just the former, there is little reason to not switch it on by default? Does it produce false negatives (requiring @trusted where unnecessary)?

And does -preview=dip25 make a difference or not? Still confused.

--Bastiaan.

January 03, 2022

On Monday, 3 January 2022 at 16:06:38 UTC, Bastiaan Veelo wrote:

>

On Monday, 3 January 2022 at 15:19:22 UTC, 12345swordy wrote:

>

On Monday, 3 January 2022 at 14:27:55 UTC, Bastiaan Veelo wrote:

>

What is in the way of integrating DIP1000 by default?

-- Bastiaan.

Bugs, and lots of them.

  • Alex

But are these bugs in the rigidity of the checks, or do other problems arise when DIP1000 is enabled? If it is just the former, there is little reason to not switch it on by default? Does it produce false negatives (requiring @trusted where unnecessary)?

The problem is usually that the checks are too loose--they allow undefined behavior in @safe code when -preview=dip1000 is enabled.

You can browse the list yourself here: https://issues.dlang.org/buglist.cgi?quicksearch=dip1000

January 03, 2022

On Monday, 3 January 2022 at 14:27:55 UTC, Bastiaan Veelo wrote:

>

As far as I know @safe is only really safe with both DIP25 and DIP1000 in effect

Conceptually, DIP 1000 does not make your existing @safe code any safer. It allows some code to be @safe that had to be @system before.

If you just want to write @safe code, and you don't care for scope, you can ignore DIP 1000. Any safety holes are just bugs, with and without -preview=dip1000.

January 04, 2022

On Monday, 3 January 2022 at 14:27:55 UTC, Bastiaan Veelo wrote:

>

As far as I know @safe is only really safe with both DIP25 and DIP1000 in effect, and I thought that DIP25 has been integrated for a while now. Nonetheless, DIP25 still appears in the list of previews (dmd -preview=help) as well as being revertible (dmd -revert=help) which adds to the confusion.

What is in the way of integrating DIP1000 by default?

-- Bastiaan.

@safe is really safe - what DIPs 25 and 1000 do is make it so more code can be @safe.

I'm currently working on making DIP1000 the default.

January 04, 2022

On Tuesday, 4 January 2022 at 08:58:04 UTC, Atila Neves wrote:

>

@safe is really safe - what DIPs 25 and 1000 do is make it so more code can be @safe.

Thanks, that clears things up considerably.

>

I'm currently working on making DIP1000 the default.

Great!

-- Bastiaan.

January 04, 2022

On Monday, 3 January 2022 at 16:06:38 UTC, Bastiaan Veelo wrote:

>

But are these bugs in the rigidity of the checks, or do other problems arise when DIP1000 is enabled?

This is the situation on dmd's master branch:
✅ = correct, considering the current language design
🆗 = correct, but is more strict than necessary
💀 = incorrect, allows memory corruption

Action no dip1000 dip1000
Take address of local variable 🆗 Error ✅ Allowed using scope when type has no pointers
Make slice of local variable 💀 Allowed ✅ Allowed using scope when type has no pointers
Take address of ref return 💀 Allowed 🆗 Allowed using scope when type has no pointers
Make slice of ref return 💀 Allowed 💀 Allowed even when type has pointers

I'm trying to turn dip1000's 💀 into an 🆗, but Walter wants to go straight to a ✅:
https://github.com/dlang/dmd/pull/13362#issuecomment-981181277

On top of this, dip1000 currently has a few more 💀s because:

>

And does -preview=dip25 make a difference or not? Still confused.

dip25 prevents returning a ref parameter by ref, unless you annotate it return ref. It's enabled by default, but only as a deprecation. -preview=dip25 turns the deprecation into an error. -preview=dip1000 implies -preview=dip25, so there's no need to use both switches.

January 04, 2022

On Tuesday, 4 January 2022 at 11:57:41 UTC, Dennis wrote:

>

This is the situation on dmd's master branch:
✅ = correct, considering the current language design
🆗 = correct, but is more strict than necessary
💀 = incorrect, allows memory corruption

Action no dip1000 dip1000
Take address of local variable 🆗 Error ✅ Allowed using scope when type has no pointers
Make slice of local variable 💀 Allowed ✅ Allowed using scope when type has no pointers
Take address of ref return 💀 Allowed 🆗 Allowed using scope when type has no pointers
Make slice of ref return 💀 Allowed 💀 Allowed even when type has pointers

I'm trying to turn dip1000's 💀 into an 🆗, but Walter wants to go straight to a ✅:
https://github.com/dlang/dmd/pull/13362#issuecomment-981181277

On top of this, dip1000 currently has a few more 💀s because:

>

dip25 prevents returning a ref parameter by ref, unless you annotate it return ref. It's enabled by default, but only as a deprecation. -preview=dip25 turns the deprecation into an error. -preview=dip1000 implies -preview=dip25, so there's no need to use both switches.

This is really helpful, thanks!

-- Bastiaan.

January 05, 2022

On Tuesday, 4 January 2022 at 11:57:41 UTC, Dennis wrote:

>

On Monday, 3 January 2022 at 16:06:38 UTC, Bastiaan Veelo wrote:

>

But are these bugs in the rigidity of the checks, or do other problems arise when DIP1000 is enabled?

I'm trying to turn dip1000's 💀 into an 🆗, but Walter wants to go straight to a ✅:
https://github.com/dlang/dmd/pull/13362#issuecomment-981181277

On top of this, dip1000 currently has a few more 💀s because:

  • parameters of pure functions can be incorrectly inferred scope, even when you can escape them with a thrown Exception. The fix is easy, but it requires updating Phobos and excel-d to pass the test suite, which is cumbersome.
    https://issues.dlang.org/show_bug.cgi?id=22221

I talked to Walter about this and I don't think it's the correct fix. I've been looking at how to do it otherwise.

« First   ‹ Prev
1 2