You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We should consider nesting DynamicLinkingType inside LinkMode.dynamic (e.g. DynamicLinkingMode will be a subtype of LinkMode).
Pros:
NativeCodeAsset will not have two fields LinkMode get linkMode;, DynamicLoading get dynamicLoading;. Which means we don't have two arguments to the constructor.
If at some point want to support dynamic loading and dynamic linking, the dynamic linking one should not support DynamicLoading.executable and DynamicLoading.process, but it should support something like bundle. Possibly system should also be supported. And it should probably have something such as built-in.
Cons:
We lose the ability to talk about "link mode is dynamic, but we haven't yet specified what the dynamic loading method is".
LinkModePreference can no longer list preferredLinkMode and potentialLinkModes. (Losing some convenience for developers who write builders that consume the link mode preference.)
Sketch:
abstractfinalclassLinkMode {}
/// Dynamic loading.////// Supported in the Dart and Flutter SDK.////// Note: Dynamic loading is not equal to dynamic linking. Dynamic linking/// would have to run the linker at compile-time, which is currently not/// supported in the Dart and Flutter SDK.abstractfinalclassDynamicLoadingimplementsLinkMode {}
/// The asset file should be bundled by Dart/Flutter.////// An asset with this dynamic loading method must provide a [Asset.file]. The/// Dart and Flutter SDK will bundle this code in the final application.abstractfinalclassDynamicLoadingBundledDylibimplementsDynamicLoading {
factoryDynamicLoadingBundledDylib();
}
/// Asset is avaliable on the target system `PATH`.abstractfinalclassDynamicLoadingSystemDylibimplementsDynamicLoading {
Uriget uri;
factoryDynamicLoadingSystemDylib(Uri uri);
}
/// Asset is loaded in the process and symbols are available through/// `DynamicLibrary.process()`.abstractfinalclassLookupInProcessimplementsDynamicLoading {
factoryLookupInProcess() =LookupInProcessImpl;
}
/// Asset is embedded in executable and symbols are available through/// `DynamicLibrary.executable()`.abstractfinalclassLookupInExecutableimplementsDynamicLoading {
factoryLookupInExecutable() =LookupInExecutableImpl;
}
abstractfinalclassDynamicLinkingimplementsLinkMode {}
abstractfinalclassDynamicLinkingBundledDylibimplementsDynamicLinking {
factoryDynamicLinkingBundledDylib();
}
/// Static linking.////// Not yet supported in the Dart and Flutter SDK.// TODO(https://github.com/dart-lang/sdk/issues/49418): Support static linking.abstractfinalclassStaticLinkingimplementsLinkMode {
staticLinkModestatic() =>StaticLinking.static();
}
I think it improves the API, but we do get a rather large subtype hierarchy that developers need to know to find the right subtype to pass. E.g. linkMode: does not auto-complete to linkMode: LinkMode.xxx. Maybe this a moot point, as currently dynamicLoading: also doesn't auto complete to dynamicLoading: SystemDylib(....
The protocol will change in a similar fashion (rendered in yaml). From: (#946 incorporated)
I think it improves the API, but we do get a rather large subtype hierarchy that developers need to know to find the right subtype to pass. E.g. linkMode: does not auto-complete to linkMode: LinkMode.xxx. Maybe this a moot point, as
Nothing prevents one from using factory constructors that create subtypes, right?
Though one can also have this as methods on the output and not expose classes:
#946 (comment)
We should consider nesting
DynamicLinkingType
insideLinkMode.dynamic
(e.g. DynamicLinkingMode will be a subtype ofLinkMode
).Pros:
NativeCodeAsset
will not have two fieldsLinkMode get linkMode;
,DynamicLoading get dynamicLoading;
. Which means we don't have two arguments to the constructor.DynamicLoading.executable
andDynamicLoading.process
, but it should support something likebundle
. Possiblysystem
should also be supported. And it should probably have something such asbuilt-in
.Cons:
LinkModePreference
can no longer listpreferredLinkMode
andpotentialLinkModes
. (Losing some convenience for developers who write builders that consume the link mode preference.)Sketch:
Uses change accordingly. From: (#946 incorporated)
to:
I think it improves the API, but we do get a rather large subtype hierarchy that developers need to know to find the right subtype to pass. E.g.
linkMode:
does not auto-complete tolinkMode: LinkMode.xxx
. Maybe this a moot point, as currentlydynamicLoading:
also doesn't auto complete todynamicLoading: SystemDylib(...
.The protocol will change in a similar fashion (rendered in yaml). From: (#946 incorporated)
@mosuem I've taken a stab at #946 (comment).
cc @mkustermann
The text was updated successfully, but these errors were encountered: