I know that Python is written in C.
Brief googling for the same question about Dart gives the answer of C++.
But if you look at Languages section on Dart SDK GitHub page you will see that C++ code has only 13.1% while Dart itself — 84.3%!
Moreover if we Ctrl+click in IDE some base method of built-in Dart type — let say the List
type add()
method — we will see that the method is written in list.dart
file actually in Dart. As many other standard data type classes and their methods.
Does it mean that some huge part of Dart is written in Dart itself? Sounds like Ouroboros.
2 Likes
I don’t have the answer to your question, but I can clarify that it isn’t abnormal for a language to be written in the same language (for example: C). You need a first iteration to bootstrap and then off you go. Moreover, you only need the core of the language to be bootstrap, most of what composes the platform tends to be framework libraries (typically written in the language itself, sometimes with some native bindings, example: Java).
4 Likes
I’m not always sure how accurate the GitHub language detection tool is, but as you’ve discovered, it’s true that a lot of Dart is written in Dart. The fact that the source code is open also means when you discover a bug, you can fix it yourself or open an issue to report it. An easy way to get started with that is to fix a spelling error you find in the documentation. I found a spelling mistake recently in the Flutter source code. (link)
2 Likes