5 ms·
quickjs.c is a 47,842 line C file. I think that sets the record for the largest handwritten file I've seen.
by pcwalton 7y ago
quickjs.c is a 47,842 line C file. I think that sets the record for the largest handwritten file I've seen.
- munificent 7y agoIs it hand-written as a single file, though? I'm assuming the release is the output of some script that does concatenation.
- saagarjha 7y agoFrom a cursory glance, it doesn't look like it's a bunch of files concatenated together.
- krferriter 7y agoIt's C so it's harder to tell than other languages, since it doesn't have separate namespaces for everything. You can just write a bunch of functions and global variables in separate files and then act like they're all in the same file, and there's really no difference.
- saagarjha 7y agoYou could, but I'm not seeing any code duplication across files so that would mean that he's not included the files that make up the "mega file", which would be rather strange.
- mantap 7y agoNot really that strange. You can have one C file that #includes the separate files that make up the big translation unit. The compiler will give you an error if a declaration is out of order.
- fightingcat 7y agoAny chance he has a super loooong screen? XD
- phaer 7y agoSome editors, like Emacs, make it very easy to work with one huge file, because you can have multiple independent views ("windows" in Emacs parlance) into the same file. It is - or maybe has been - quite common to work like this in LISP communities.
- kizer 7y agoAlthough decomposition into corresponding files is the norm, it’s so satisfying to say “hey, check out my JS engine” and point people to a single work-of-art uberfile. LOL.
- dang 7y ago"Don't be snarky." "Please don't post shallow dismissals, especially of other people's work. A good critical comment teaches us something." https://news.ycombinator.com/newsguidelines.html https://news.ycombinator.com/newsguidelines.html
- kizer 7y agoIt wasn’t sarcasm. I was being sincere.
- dang 7y agoI believe you, but a comment like that is going to pattern-match to the internet default, which is snark, in nearly every reader's mind.
- ibly31 7y agoI think you are overreacting here, his comment was definitely not interpreted as sarcastic. Quite the opposite, it was showing appreciation for what an achievement QuickJS is.
- kizer 7y agoI was not being sarcastic!!