What is the true meaning of pass-by-reference in modern languages like Dart?
问题 Working with Futures in Dart, I've come across an interesting issue. import 'dart:async'; class Egg { String style; Egg(this.style); } Future cookEggs(List<Egg> list) => new Future(() => ['omelette','over easy'].forEach((_) => list.add(new Egg(_))) ); Future cookOne(Egg egg) => new Future(() => egg = new Egg('scrambled')); void main() { List<Egg> eggList = new List(); Egg single; cookEggs(eggList).whenComplete(() => eggList.forEach((_) => print(_.style)); cookOne(single).whenComplete(() =>