Language Feature: Parallel Assignment #10267
Labels
area-language
Dart language related items (some items might be better tracked at github.com/dart-lang/language).
closed-duplicate
Closed in favor of an existing report
type-enhancement
A request for a change that isn't a bug
This issue was originally filed by @simonpai
Maybe it's possible to support parallel assignment like in Ruby and Python. For example:
// return domain, port,
(String, int) parseURL(String url) { ... }
String domain;
int port;
(domain, port) = parseURL('http://dart.com:9999'); // gets domain = 'dart.com', port = 9999
or even more elegantly:
(String domain, int port) = parseURL('http://dart.com:9999');
Dart should be able to keep the all type information in compile time, so it has benefit over returning an unparametrized List. But I am not sure how many effort it takes to implement this.
This is not a must-have feature, but shall come in handy when you need it.
The text was updated successfully, but these errors were encountered: