-
Notifications
You must be signed in to change notification settings - Fork 1.7k
breaking-change-request: const.fromEnvironment requires compile-time environment when compiled via kernel and run on the VM #36579
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
LGTM |
sgtm |
SGTM But please wait a bit longer before landing; the external announcement was just made, so we need to offer enough time for externals to offer feedback. |
Is it the plan to also remove the support for If we want to remove support for |
It is a good question, I don't have a final answer. At this time, the answer is no, but long term the value you get back may change. If the resolution of dart-lang/language#304 is that Even though this is not changing at this time, I didn't suggest it as a mitigation because it has the potential to break again in the future. |
@aadilmaan - are you tracking what we should do here and when? |
Do we need anything here beyond a CHANGELOG update? |
@vsmenon - The announce email has been sent out. We have the approvals, we can land this change when ready unless folks feel we need to wait a little more for feedback. |
I believe we landed the change in BE. :-) It's the behavior of the new const-update flag. If we ship that in 2.3, we're going forward with this change. If we revert (looking unlikely at this point), we're not. |
We will be flipping the flag immediately after D24. Moving to next milestone. |
@vsmenon @aadilmaan the flag has been flipped on. I think this should have been closed? |
@srawlins - you are correct |
I just realized that this change also affected script snapshots generated with |
Yes it is intentional, the change is covered in the line
script snapshots are nothing but kernel files in Dart 2. |
Dart exposes a const
fromEnvironment
constructor inString
,int
, andbool
. These constants return the value of an environment variable.There is no concrete specification on when the environment is defined today (filed as request at dart-lang/language#304), and as a result different implementations capture the environment variables at different times:
Planned Change
We will no longer support using a runtime environment in (e). If no environment is provided when creating kernel files, the VM will complain that the input kernel files contain unevaluated constants.
In terms of support for
fromEnvironment
, this makes the scenario in (e) match what's allowed with AOT in (c). Support for (d) is not changed.See #36513 for more context
Expected Impact
Most users run the VM directly from sources (scenario (d) above) and will not be affected.
This change is only visible when users:
-D
flagsWe expect this may affect users of build systems like bazel and GN where it is common to build kernel files as intermediate artifacts before running a VM. This may also affect users of
build_runner
if they are using a configuration with intermediate kernel files.pub [global] run
is not affected because it doesn't use-D
flags.Mitigation
-D
flags at the time the kernel artifacts are built instead of providing them to thedart
commandPlatform.environment
instead@aadilmaan @mit-mit @Hixie @matanlurey
The text was updated successfully, but these errors were encountered: