I'm not sure why one would do this over simply using an array... Delete in particular is a somewhat costly execution penalty.
class Queue {
constructor() {
this._items = [];
}
enqueue(item) {
this._items.push(item);
}
dequeue() {
return this._items.shift();
}
peek() {
return this._items[0];
}
get length() {
return this._items.length;
}
}
I think that Cloudflare workers are a great idea, and could be awesome for some projects. I'm not sure there's a self-hosted option as a migration strategy though... Short of an open platform to self-host at least for development, it just feels like the ultimate lock-in strategy.
I find part of the argument deeply flawed... In particular:
> Dart is not a widespread language compared to ... Kotlin, Swift
The main reason Kotlin and Swift are widespread is because they are platform languages themselves. Part of considering a cross-platform language is expressly to avoid/reduce the tether of platform languages.
While it seems that I have to remove several Flutter articles a week, I can see the appeal. I also see the appeal for React Native as well as the work on Xamarin Forms, and the MAUI support coming in .Net 6 (though lack of Linux targets in the near term is disappointing there).