-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Resolve / announce breaking change on const X.fromEnvironment
in VM
#36513
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Marking as P0 as this is a blocker for 2.3. |
fyi - @mit-mit on breaking change. Some more context:
Based on this, I think we should roll forward with the change. |
Ugh. That's nasty. Let's get the email out ASAP. This may affect SASS IIRC – @nex3 |
cc @aadilmaan for breaking change management |
One thought: internally we will handle this in three steps: 1) produce kernel with defaults hardcoded for these consts; 2) ban A way to provide an equivalent path externally would be to make the CFE always hardcode defaults and make the VM refuse to start up with |
Clarification: It is only the scenario where a Dart program is compiled to a dill file (without specifying an environment) and that dill file is run on the VM (specifying a runtime environment that is supposed to affect the environment constants) which does not work anymore. I would expect that very few external users do this. |
Yes. I think the key question is whether any of the build tools we publish (e.g. package:build) use dill files in a way which will be affected. |
@jakemac53 @natebosch on the build tools question. |
@a-siva - thoughts on locking down |
We have never supported passing any custom arguments to the modular compilers, so neither DDC nor Kernel support this externally (via package:build at least). We could in theory support it but only as a global option (the only way it makes sense to use it), and we don't have the ability to make global-only options, although we could add that in the future. This would basically be equivalent to supporting it through some However, I don't think that actually produces a desirable workflow (it would invalidate all modular dart actions in both cases), and I don't think its worth supporting without really compelling use cases. |
It still makes sense for the VM to accept |
@askeksa-google - the concern (see discussion in b/129881700) is that, when running from dill, users will now see a different value depending on whether they use So, either we should explain that very clearly or disallow it. Because of that difference, the internal code is being migrated to use |
I'm not sure having two different environments makes sense. I'd prefer if the environment is locked down at one particular point in time, usually compilation time, and after that you cannot change it. The |
@jakemac53 The question is not whether we have allowed people to pass |
To summarize where we are:
@kevmoo - what's your take? The general consensus seems to be that the breaking change here has low impact. |
As long as Dart Sass can specify the constant at either snapshot-generation time or runtime, our use-case is satisfied. |
@Hixie @matanlurey for approval for this breaking change request. |
That being said, I'd love to see this be an explicit error (or stop being a |
@matanlurey - see also more details about internal uses are in b/129881700 |
I'm satisfied with the process taking place there, thanks! |
A quick look through Is there any documentation of |
@jonasfj - thanks for checking. The only way to define these constants is via the @a-siva - I believe this doesn't affect downstream users in flutter/fuschia, but please confirm when you have details. Assuming there are no surprises I also vote in favor of this change (voting in lieu of @dgrove who is OOO). @mit-mit, here as well, since @dgrove is OOO, could you |
…tokens This will be used instead of -DprintTokens=true. Context: we use this tool in bazel where we use a modular pipeline. That pipeline will no longer support dart environment variables due to #36513. In this specific file the intent was anyways to pass an option when launching the program, so a command-line option is appropriate IMO. Change-Id: I5187190a01afe59aef57ec6a7311b1e380313a81 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/99102 Reviewed-by: Ari Aye <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]> Commit-Queue: Sigmund Cherem <[email protected]>
I don't understand what is being proposed here. |
by "works" I mean in Flutter, specifically, the kReleaseMode constant seems to work, and is defined as: const bool kReleaseMode = bool.fromEnvironment('dart.vm.product', defaultValue: false); |
We also use |
@Hixie void main() {
const int.fromEnvironment('flag');
} |
Correction: The changes affect the situation where a Dart program is compiled to a dill file without specifying an environment, and then an environment is specified on the VM commandline when running from that dill file. In that scenario, If an environment is specified to the front end when compiling to dill, and that dill file is then run on the VM, |
There seems to be a lot of confusion due to the long discussion and format of this bug, so I filled a new issue using a more structured breaking change proposal template in #36579 Hope this helps! |
closing this in favor of #36579 |
The VM is about to switch to use the CFE's constant evaluator. This change will break const.fromEnvironment on modular builds (which affects blaze and build_runner). Because the only purpose of these definitions was to pass arguments to tests, we can replace them with a runtime Platform.environment variable. Context: b/129881700 and dart-lang/sdk#36513 PiperOrigin-RevId: 242916194
The VM is about to switch to use the CFE's constant evaluator. This change will break const.fromEnvironment on modular builds (which affects blaze and build_runner). Because the only purpose of these definitions was to pass arguments to tests, we can replace them with a runtime Platform.environment variable. Context: b/129881700 and dart-lang/sdk#36513 PiperOrigin-RevId: 242916194
The VM is about to switch to use the CFE's constant evaluator. This change will break const.fromEnvironment on modular builds (which affects blaze and build_runner). Because the only purpose of these definitions was to pass arguments to tests, we can replace them with a runtime Platform.environment variable. Context: b/129881700 and dart-lang/sdk#36513 PiperOrigin-RevId: 242916034
The VM is about to switch to use the CFE's constant evaluator. This change will break const.fromEnvironment on modular builds (which affects blaze and build_runner). Because the only purpose of these definitions was to pass arguments to tests, we can replace them with a runtime Platform.environment variable. Context: b/129881700 and dart-lang/sdk#36513 PiperOrigin-RevId: 242916034
Currently, with the constant-update-2018 change, the VM no longer supports (or plans to support)
const X.fromEnvironment
for values defined at runtime in JIT mode.That would make it consistent (?) with the VM in AOT mode, Dart2JS, and DDC.
If we're agreed on this behavior going forward, we need a breaking change announcement.
@a-siva @leafpetersen @lrhn @kmillikin @sigmundch @aadilmaan
The text was updated successfully, but these errors were encountered: