-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Spec: specify what URIs in imports resolve against #2294
Comments
Added Area-Language, Triaged labels. |
Added this to the M1 milestone. |
I imagine we want the latest IETF RFC on this, but in fact, I am reluctant to specify anything about URI interpretation, as this wil depend on the embedder. This includes what to do with relative URIs (package managers may choose one policy, non-file based environments another etc.) how to treat special URI schemes (like dart: or package:) and even standard URIs (which might depend on the browser. |
This comment was originally written by [email protected] URIs are hard, I think no browser actually implements a proper RFC compliant environment. So admittedly specifying something there might be more trouble than it's worth. However I'd have hoped that Dart would specify what relative URIs are supposed to mean. The import structure of a collection of Dart sources seems to be an important piece of the language. It seems a bit conflicting to specify that it's URIs on the one hand, but then have the embedder do something magic afterwards without using or mandating anything that happens with the URIs. From that perspective, you could also just drop the URI part entirely and just treat the imports as opaque strings, right? |
Martin, I agree this is a grey area. I personally think imports should use identifiers and let the environment sort things out. As for relative URIs I can imagine environments where you want different things. I hope we'll resolve this soon. |
Incidentally, I outlined something similar in issue #3148. The URI in an #import or #source tag should be resolved as described in RFC 3986. When resolving a URI, one must determine the base URI. For #import and #source tags the base URI should be the retrieval URI of the compilation unit in which the tag appears. See http://tools.ietf.org/html/rfc3986#section-5.1.3 I don't see how the resolution mechanism would interfere with any embedder, in fact, I see it as a problem if a naive embedder makes distinctions between relative URIs and absolute URIs. So I think this should be described in the specification. And just to make sure this has been said: a relative URI is not a file name. |
The 0.11 draft now contains a description of package:, dart: and relative URI behavior, all ultimately dependent on the embedder's interpreation of URIs. I think this is all we can do. Added Done label. |
New commits included in this revision: ``` $ git log --pretty=oneline 4d8ecbd409d773fec47da33b7e6c8db0b51487fd..429a06039d185149f387a65e3503b0693ce6d24e 429a06039d185149f387a65e3503b0693ce6d24e (HEAD -> master, origin/master, origin/HEAD) Parallel fetching of available versions (#2280) 6705b085b9bf4754a4c8002a070f436f115dc4d1 Retry on all SocketExceptions (#2254) a1820273b9f3c7bb5a13d26cd14d30d5bab187ae Use a unqiue file name for the snapshot during testing. (#2303) 72686563e767f8a359e48a267a2c323953a6a0ef Include osx and windows testing on Travis (#2299) a7a66821d13920b9b22cc394dfa55c679e971e40 Fail travis for lints and warnings (#2301) 25aa24c023453f064dad8f3cce1bbd55269d0efa Omit languageVersion when there is no SDK constraint (#2300) 82e60a3dcb3afe753563e7d304827fb650bc4833 Use LOCALAPPDATA for system cache on windows (#2297) ceaa86f2c7eb35f044b4c202268a17361de68d13 Enforce and fix lints from package:pedantic (#2291) 6ce1606564352c305bd0f6d97704f0f7f6ebbca0 Use more collection literals for args (#2293) be245e6baeebb71aaf3b3a260fcfbbb011a9a7e0 Rename some test utilities from Mock to Fake (#2294) f7638ce85298df7d9e73d717dd4d81f499681720 Refactor Set.add following !Set.contains (#2295) 390022b24bc076cb934385936ac7904f045a75ba Filter out `null` from `getCachedPackages`. (#2292) 0eea0c4421ed0b83c8597b62dacf68b93de172b9 Fix existing hints and lints (#2290) 7cf2fe860a40517ccb65f5efdda9e4dc350142c3 promote strict deps failures to errors from warnings (#2289) ``` Change-Id: I62782b29e16092114940df00811bfdd20c8045fa Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/131839 Reviewed-by: Jonas Jensen <[email protected]> Commit-Queue: Sigurd Meldgaard <[email protected]>
…ocess, vector_math, web, webdev Revisions updated by `dart tools/rev_sdk_deps.dart`. native (https://github.com/dart-lang/native/compare/0051e78..b5827f3): b5827f3b 2023-11-29 Daco Harkes [infra] Hide TODOs from problems view in VSCode (#837) 17487159 2023-11-29 Liam Appelbe [ffigen] Only use `objc_msgSend` variants on x64 (#836) 50b6a783 2023-11-28 Ryan Macnak [native_toolchain_c] Setup Android RISCV64 toolchain. (#165) aa58de61 2023-11-28 Daco Harkes [native] Bump deps (#834) 6cf4c783 2023-11-28 Daco Harkes [native_assets_builder] Only build native assets for dependencies of requested package (#833) f1221814 2023-11-28 Daco Harkes [ffigen][infra] Use Apple silicon on CI (#832) source_span (https://github.com/dart-lang/source_span/compare/ed16e0d..9398e24): 9398e24 2023-11-29 Kevin Moore Move to latest lints, require Dart 3.1 (#106) stack_trace (https://github.com/dart-lang/stack_trace/compare/6496ff8..4abff44): 4abff44 2023-11-29 Kevin Moore Latest lints, require Dart ^3.1 (#146) test_descriptor (https://github.com/dart-lang/test_descriptor/compare/c417cbb..59ce97f): 59ce97f 2023-11-29 Kevin Moore Bump and fix latest lints, require Dart 3.1 (#60) test_process (https://github.com/dart-lang/test_process/compare/c21e40d..d68de5b): d68de5b 2023-11-29 Kevin Moore Update lints, require Dart ^3.1 (#52) vector_math (https://github.com/google/vector_math.dart/compare/e4066cc..cca3cf1): cca3cf1 2023-11-27 Devon Carew Update README.md (#308) web (https://github.com/dart-lang/web/compare/fdfbaef..cffc2e3): cffc2e3 2023-11-30 Devon Carew parse spec info for generated libraries (#111) d902401 2023-11-29 Devon Carew update the readme (#110) e5be5b3 2023-11-28 Devon Carew delete previously generated files when generating (#108) webdev (https://github.com/dart-lang/webdev/compare/6961b20..63e09e5): 63e09e50 2023-11-30 Elliott Brooks Remove unused scripting code and permission (#2294) 8c225550 2023-11-29 Elliott Brooks Prepare Dart Debug Extension for MV3 release (#2293) 3bb4a6a6 2023-11-28 Elliott Brooks Remove old code from before the new Dart Debug Extension (#2290) Change-Id: Ia219625dce03494620a73272e8d1bde03e2e8aea Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/339222 Reviewed-by: Konstantin Shcheglov <[email protected]> Commit-Queue: Devon Carew <[email protected]> Auto-Submit: Devon Carew <[email protected]>
This issue was originally filed by [email protected]
The specification (0.08) in sections Imports and Includes refers to URIs, e.g. "An import provides a URI where the declaration of the imported library is to be found."
It does not specify what a relative URI would resolve against, options would be the URI of the "main" dart file that's imported first, the URI of the HTML file that embeds the Dart application, or the current source file (which appears to be what's implemented at the moment).
It also does not specify which URI spec should be applied, RFC 2396 (http://www.ietf.org/rfc/rfc2396.txt), RFC 3986 (http://www.ietf.org/rfc/rfc3986.txt), or even RFC 1630 (http://www.ietf.org/rfc/rfc1630.txt, really old and obsolete).
The text was updated successfully, but these errors were encountered: