Skip to content

Conversation

@JinShil
Copy link
Contributor

@JinShil JinShil commented Mar 16, 2018

delete was deprecated in 2.079. Before the delete keyword can be removed it will be necessary to also deprecate and remove class allocators and deallocators. They have been planned for deprecation for years; this PR finally puts the deprecation process in motion.

See https://dlang.org/deprecate.html#Class%20allocators%20and%20deallocators

dlang.org PR: dlang/dlang.org#2277

@dlang-bot
Copy link
Contributor

Thanks for your pull request, @JinShil!

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.

}
---

For more information see https://dlang.org/deprecate.html#Class%20allocators%20and%20deallocators
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably a good idea to point users to alternatives like std.experimental.allocator and other RAII articles.
See also: https://issues.dlang.org/show_bug.cgi?id=18613

Copy link
Contributor Author

@JinShil JinShil Mar 16, 2018

Choose a reason for hiding this comment

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

Please enumerate specifically which articles I should include and I'll add them.

Copy link
Contributor

Choose a reason for hiding this comment

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

Probably this page is the best we have at the moment - https://dlang.org/blog/the-gc-series

It doesn't really mention stdx.allocator, so I would probably mentioned that separately.

How about:

Many alternatives for class allocators/deallcators exist, among many is the generic $(REF make, std,experimental,allocator) and $(REF dispose, std,experimental,allocator) from the allocator package. For other alternatives, see $(LINK2 https://dlang.org/blog/the-gc-series, the recent article about memory allocation on the DBlog)

(just an idea)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done. Thanks!

{
//printf("NewDeclaration::semantic()\n");

// @@@DEPRECATED_2019-05@@@
Copy link
Contributor

Choose a reason for hiding this comment

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

We recently switched to using an explicit version, see also dlang/DIPs#108 or dlang/phobos#6286 for an example

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.

Please don't do this for class allocators. We have recently discovered that they can be used to prevent the usage of new (when marked @disable hence forcing people to use custom phobos-style allocators.

I planned to add this to my user library but forgot to. This user library is now in the project tester so this change would really be embarassing.

For deallocators ok since delete is deprecated.

@JinShil
Copy link
Contributor Author

JinShil commented Mar 16, 2018

I've added support for the syntax @disable new();. You won't even need to add the useless size_t argument. That should prevent any breaking changes.

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 new version allows the @disable trick so it's good.

}
}
---

Copy link
Contributor

Choose a reason for hiding this comment

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

The new @disable new(); syntax should be mentioned here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

Copy link
Contributor

@wilzbach wilzbach left a comment

Choose a reason for hiding this comment

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

Nice!

@wilzbach wilzbach added this to the 2.080.0 milestone Mar 22, 2018
@JinShil
Copy link
Contributor Author

JinShil commented Mar 23, 2018

I'm labeling this as "Vision", as I think it corresponds to item 1 in the stated vision.

Lock down the language definition: D is a powerful language but its definition is not precise enough. A number of subtleties can only be assessed only by running the compiler, not by perusing the specification. This semester we are pushing for a better, more precise, and more complete specification of the D language.

While that statement was probably intended largely for documentation, there are two sides to that coin: 1. ensuring the specification documents the implementation, 2. ensuring the code implements the documentation; they are one and the same.

Deprecations are updates to the specification. Documenting that something is deprecated without actually implementing said deprecation is to disregard the specification.

Moving these deprecations forward is locking down the language, and doing it sooner rather than later avoids problems that crop up when users choose to leverage a deprecated feature in some unexpected way, forcing us to make accomodations later.

@JinShil JinShil added the Review:Vision Vision Plan https://wiki.dlang.org/Vision/2018H1 label Mar 23, 2018
@wilzbach
Copy link
Contributor

@WalterBright @andralex I think your approval for this deprecation is required?
(it's more a formal thing because it has been on the list of to be deprecated for a long time)

@wilzbach wilzbach added the Merge:72h no objection -> merge The PR will be merged if there are no objections raised. label Mar 30, 2018
@andralex
Copy link
Member

Affirmative. Let's move with deprecation. Thanks.

@wilzbach wilzbach added Merge:auto-merge and removed Merge:72h no objection -> merge The PR will be merged if there are no objections raised. labels Mar 30, 2018
@wilzbach
Copy link
Contributor

Windows failure is unrelated -> braddr/d-tester#71

There was one spurious failure on OSX in druntime

https://auto-tester.puremagic.com/show-run.ghtml?projectid=1&runid=3098596&isPull=true

Testing invalid_memory_operation
timelimit -t 10 ./generated/osx/debug/32/invalid_memory_operation  2>&1 1>/dev/null | grep -qF "InvalidMemoryOperationError"
timelimit -t 10 generated/osx/release/32/unittest/test_runner core.sys.dragonflybsd.netinet.in_
make[2]: *** [generated/osx/debug/32/invalid_memory_operation.done] Error 1
rm generated/osx/debug/32/unknown_gc generated/osx/debug/32/stderr_msg generated/osx/debug/32/static_dtor generated/osx/debug/32/future_message generated/osx/debug/32/invalid_memory_operation
make[1]: *** [test/exceptions/.run] Error 2
make: *** [unittest-debug] Error 2
make: *** Waiting for unfinished jobs....
```

Let's see whether this is repeats itself - otherwise "merge ahoy!"

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

Labels

Merge:auto-merge Review:Vision Vision Plan https://wiki.dlang.org/Vision/2018H1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants