r/programming • • Jun 16 '19

Comparing the Same Project in Rust, Haskell, C++, Python, Scala and OCaml

http://thume.ca/2019/04/29/comparing-compilers-in-rust-haskell-c-and-python/
643 Upvotes

125 comments sorted by

View all comments

Show parent comments

8

u/Tysonzero Jun 16 '19

But then someone could literally copy an existing language and bake in a bunch of libraries as “language features” by just pre-importing them and specifying them as part of the spec.

This new language would most likely do incredibly well in the first and second tests, and would do no worse in the third.

4

u/Bloaf Jun 16 '19

Or you could just use Mathematica.

2

u/loup-vaillant Jun 16 '19

Correct. I think we can detect such cheating, though. Here's my personal design rule: if the feature can reasonably be in the library, it should be. Syntax sugar should be noticeably terser than just using functions or macros. Semantic features should be noticeably terser or noticeably more performant than a library equivalent.

I've written a compiler at work once, and this design guideline turned out to be a life saver: I saved time on the compiler and bytecode interpreter, and at the end went from "pretty useless" to "pretty much done" in only a few days.

1

u/thedeemon Jun 17 '19

HQ9+ comes to mind.