dart-lang / sdk

The Dart SDK, including the VM, JS and Wasm compilers, analysis, core libraries, and more.
https://dart.dev
BSD 3-Clause "New" or "Revised" License
10.25k stars 1.58k forks source link

consider refactoring giant 'uri.dart' #37152

Open zichangg opened 5 years ago

zichangg commented 5 years ago

Uri.dart has become a huge file for dart:core. I tried to add user-specific feature onto Class uri, which could be a burden for all the other users. Would it be better to extract most class uri into a single package?

zichangg commented 5 years ago

@kevmoo @lrhn @a-siva

lrhn commented 5 years ago

See also #29420

This was one thing we had hoped to do for Dart 2.0, but did not have the resources for. We wanted to move a lot of functionality out of the Uri class, and make it closer in behavior with the JavaScript URL class (to enable web compilation to use that class as an implementation). It would remove much of the normalization functionality, which could then be provided by a package instead. Alas, migrating to strong mode was hard enough without adding extra breakage.

Changing anything about how the Uri class works is a breaking change. It is widely used, and while most uses can probably survive with a core functionality, there are definitely some uses which depends on the full normalization that the class supplies.

Maybe for Dart 3.0.

zichangg commented 5 years ago

Summarized from discussion in my CL and put it here as a potential request. Consider providing fields for raw URI parts, current implementation will only contains normalized version.