Skip to content

Add predefined version identifier D_BoundsChecks#8532

Closed
Geod24 wants to merge 1 commit intodlang:masterfrom
Geod24:no-no-yes
Closed

Add predefined version identifier D_BoundsChecks#8532
Geod24 wants to merge 1 commit intodlang:masterfrom
Geod24:no-no-yes

Conversation

@Geod24
Copy link
Member

@Geod24 Geod24 commented Aug 2, 2018

One stylistic rule that is strictly enforced in D is that
version identifier and CLI switch should be positive.
`D_NoBoundsChecks` stands out as an exception in this regard.
This PR just adds `D_BoundsChecks` so that code have at least
one release to transition to it, before `D_NoBoundsChecks` is deprecated.

@dlang-bot
Copy link
Contributor

Thanks for your pull request and interest in making D better, @Geod24! We are looking forward to reviewing it, and you should be hearing from a maintainer soon.
Please verify that your PR follows this checklist:

  • My PR is fully covered with tests (you can see the annotated coverage diff directly on GitHub with CodeCov's browser extension
  • My PR is as minimal as possible (smaller, focused PRs are easier to review than big ones)
  • I have provided a detailed rationale explaining my changes
  • New or modified functions have Ddoc comments (with Params: and Returns:)

Please see CONTRIBUTING.md for more information.


If you have addressed all reviews or aren't sure how to proceed, don't hesitate to ping us with a simple comment.

Bugzilla references

Your PR doesn't reference any Bugzilla issue.

If your PR contains non-trivial changes, please reference a Bugzilla issue or create a manual changelog.

Testing this PR locally

If you don't have a local development environment setup, you can use Digger to test this PR:

dub fetch digger
dub run digger -- build "master + dmd#8532"

@Geod24 Geod24 added Review:Easy Review Review:Needs Spec PR A PR updating the language specification needs to be submitted to dlang.org labels Aug 2, 2018

One stylistic rule of D is that version identifier should be positive.
`D_NoBoundsChecks` stands out as an exception in this regard.
This version adds the opposite `D_BoundsChecks` so that code have at least
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we might be subject to the deprecation policy being proposed at https://github.com/dlang/DIPs/blob/master/DIPs/DIP1013.md

src/dmd/mars.d Outdated
VersionCondition.addPredefinedGlobalIdent("assert");
if (global.params.useArrayBounds == CHECKENABLE.off)
VersionCondition.addPredefinedGlobalIdent("D_NoBoundsChecks");
else // Introduced in 2.082.0 - Deprecate `D_NoBoundsChecks` later
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use the deprecation comment syntax proposed in https://github.com/dlang/DIPs/blob/master/DIPs/DIP1013.md for easy grepping, and remain consistence with other deprecations in the code base.

@JinShil
Copy link
Contributor

JinShil commented Aug 2, 2018

Fine with me after we have a spec update and we get deprecation policy sorted out.

Copy link
Member

@WalterBright WalterBright left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not "strictly" enforced, just a strong bias that direction. Also, it should be removed from the documentation (and this added).

@Geod24
Copy link
Member Author

Geod24 commented Aug 3, 2018

@JinShil : Thanks for the link, didn't knew about it.
I wanted to introduce the version identifier for at least one release before deprecating the other identifier, so that transition is smoother. What do you think ?

Geod24 added a commit to Geod24/dlang.org that referenced this pull request Aug 3, 2018
As explained in dlang/dmd#8532 the prefered style is positive version identifiers.
The DMD PR adds the new version identifier to be used for at least a release before D_NoBoundsChecks is deprecated.
In the meantime, it can already be undocumented.
@Geod24
Copy link
Member Author

Geod24 commented Aug 3, 2018

dlang/dlang.org#2438

@Geod24
Copy link
Member Author

Geod24 commented Aug 3, 2018

Also found https://issues.dlang.org/show_bug.cgi?id=19137 out

@Geod24 Geod24 closed this Aug 3, 2018
@Geod24 Geod24 reopened this Aug 3, 2018

One stylistic rule of D is that version identifier should be positive.
`D_NoBoundsChecks` stands out as an exception in this regard.
This version adds the opposite `D_BoundsChecks` so that code have at least
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it should be either code bases or projects (code can't transition itself, can it?)

@WalterBright
Copy link
Member

Also found https://issues.dlang.org/show_bug.cgi?id=19137 out

Good catch. I withdraw my approval until this is sorted out.

Copy link
Member

@WalterBright WalterBright left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to resolve bug 19137

@Geod24
Copy link
Member Author

Geod24 commented Aug 6, 2018

@WalterBright : Could you give your opinion on said bug ? My original thought was that we could apply D_BoundsChecks when the scope is @safe but I'm afraid it will introduce a bad precedent. E.g. what about a template specialization which is @safe and has invalid code in its D_BoundsChecks versioned code ?

On the other hand @JinShil proposed to introduce D_SafeBoundsChecks, which is a much simpler approach but makes it more difficult for the user. One has to know which one to use, and it might not be possible (e.g. when templates are used).

Do you have an alternative idea, or do you prefer one of those ?

@Geod24 Geod24 removed the Review:Needs Spec PR A PR updating the language specification needs to be submitted to dlang.org label Aug 7, 2018
One stylistic rule that is strictly enforced in D is that
version identifier and CLI switch should be positive.
`D_NoBoundsChecks` stands out as an exception in this regard.
This PR just adds `D_BoundsChecks` so that code have at least
one release to transition to it, before `D_NoBoundsChecks` is deprecated.
@thewilsonator thewilsonator self-assigned this Nov 7, 2018
Geod24 added a commit to Geod24/dlang.org that referenced this pull request Jan 30, 2019
As explained in dlang/dmd#8532 the prefered style is positive version identifiers.
The DMD PR adds the new version identifier to be used for at least a release before D_NoBoundsChecks is deprecated.
In the meantime, it can already be undocumented.
Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This not worth starting a deprecation. New version identifiers however should follow the rule of being "positive". Also even if unlikey, the new reserved version could exist somewhere in some code, so a deprecation would also be required, making this (even if simple) change a long process.

I suggest @Geod24 to close.

@ghost ghost added the Review:Needs Rebase label Aug 3, 2020
@Geod24
Copy link
Member Author

Geod24 commented Aug 3, 2020

Yes the benefit of this is very low, hence why I haven't pursued it. However, one note: version identifiers starting with D_ are reserved so there wouldn't be a need for a deprecation.

@Geod24 Geod24 closed this Aug 3, 2020
@ghost
Copy link

ghost commented Aug 3, 2020

ok, note taked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants