Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.
/ druntime Public archive

Comments

Revert PR 2194 - Don't needlessly import everything in object.d when compiling with -betterC#2208

Merged
dlang-bot merged 1 commit intodlang:masterfrom
JinShil:revert_betterc_import_reduction
Jun 10, 2018
Merged

Revert PR 2194 - Don't needlessly import everything in object.d when compiling with -betterC#2208
dlang-bot merged 1 commit intodlang:masterfrom
JinShil:revert_betterc_import_reduction

Conversation

@JinShil
Copy link
Contributor

@JinShil JinShil commented Jun 4, 2018

It is with great disappointment that I must revert #2194, which reduced imports in object.d when compiling with -betterC to just the language features supported by that subset of the language.

The problem is not actually with that PR per se, but rather with a fundamental design flaw in D: There is no way to determine which code is needed at compile-time and which code is needed at runtime.

Users of -betterC may wish to employ features of D at compile-time that are not available in the -betterC subset of the language at runtime. An obvious example is pragma(msg, typeid(size_t));. That code, as ridiculous as it is, is currently possible in -betterC despite the fact that it requires TypeInfo which is a feature not available in -betterC at runtime. If users are doing such things in -betterC, then #2194 will introduce regressions. #2194 should have actually been implemented at the time -betterC was first introduced, but we're past that point now.

To resolve this issue in a more prudent manner, we either need to decide that compile-time -betterC and runtime -betterC must have feature parity, or we need to add a version(CTFE) feature to the language to segregate compile-time features and runtime features. This is actually a general cross-compilation issue: Users may want to have features of D available at compile-time that are not supported by their runtime target. But that's not a battle I'm prepared to fight at this time.

object.d is a complete mess, and github's diff algorithm is not able to understand it, so relocating code back to their original locations and fixing indentations will turn this PR's diff into a monstrosity, as demonstrated by #2194's diff. Therefore, I'm leaving implementations where they are and just reverting the version(D_BetterC) and version(No_BetterC) scopes so reviewers will have an easier time reviewing. I can always submit future PRs to adjust the formatting and code locations if necessary.

I'm sorry for the noise; it's part of the process when developing experimental features and learning the corner cases.

@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.

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 + druntime#2208"

Copy link
Member

@Geod24 Geod24 left a comment

Choose a reason for hiding this comment

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

LGTM
Could you add the PR description as commit message ? It is very informative and would be more accessible this way.

…compiling with -betterC

The problem is not actually with PR 2194 per se, but rather with a fundamental design flaw in D: There is no way to determine which code is needed at compile-time and
which code that is needed at runtime.

Users of -betterC may wish to employ features of D at compile-time that are not available in the -betterC subset of the language at runtime. An obvious example is
pragma(msg, typeid(size_t));. That code, as ridiculous as it is, is currently possible in -betterC despite the fact that it requires TypeInfo which is a feature not
available in -betterC at runtime. If users are doing such things in -betterC, then #2194 will introduce regressions. #2194 should have actually been implemented at the
time -betterC was first introduced, but we're past that point now.

To resolve this issue in a more prudent manner, we either need to decide that compile-time -betterC and runtime -betterC must have feature parity, or we need to add a
version(CTFE) feature to the language to segregate compile-time features and runtime features. This is actually a general cross-compilation issue: Users may want to
have features of D available at compile-time that are not supported by their runtime target. But that's not a battle I'm prepared to fight at this time.
@JinShil
Copy link
Contributor Author

JinShil commented Jun 5, 2018

Could you add the PR description as commit message?

done

@dlang-bot dlang-bot merged commit 42e7e93 into dlang:master Jun 10, 2018
@JinShil JinShil deleted the revert_betterc_import_reduction branch June 19, 2018 11:09
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants