Live data from Hacker News

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

thume.ca

31–40 of 384 posts

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

#31
post #22

If you're into this sort of thing, definitely check out the ICFP Programming Contest -- take next Friday off and join in on the fun! https://icfpcontest2019.github.io/

> Any programming language(s) on any platform(s) may be used.

How does this work? What’s stopping me from using some hyperpowered esolang I cooked up for the competition?

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

#32
post #28

Earlier quoted context omitted.

And just syntax decision. if (x) { y } else { z } if x: y else: z Assuming x and y are 1 line but long enough expressions you don't want to use a trinary operator (available in both) the python is 2/3rds the length of the c because of bracketing. Obviously cherry picked, but I bet these differences add up.

Of course, you can omit the braces if there’s a single statement (though I personally never do this).

Sure, and you can put the else on the same line as the end of the if block even without doing that. Or you could make the difference bigger by putting the opening brace on a newline.

I wrote the style of C that I actually write, but it's probably not fair for me to label it as a property of just the language.

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

#33
post #29
post #10

Earlier quoted context omitted.

They probably wouldn't have been able to finish the project in time.

And a good professor would have flunked them for poor judgment.

I doubt I will ever be a professor, but I would be happy to pass any student who did this provided they did the task adequately. Maybe extra points for cheekiness.

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

#34
post #32

Earlier quoted context omitted.

Of course, you can omit the braces if there’s a single statement (though I personally never do this).

Sure, and you can put the else on the same line as the end of the if block even without doing that. Or you could make the difference bigger by putting the opening brace on a newline. I wrote the style of C that I actually write, but it's probably not fair for me to label it as a property of just the language.

I think it’s a fair point to bring up given that many people actually do write their code that way.

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

#35
I find it curious that both the team that used C++, and the author, both appear to believe that sum types and related facilities are not usable or conveniently expressible in C++.

I got that Boost Spirit, a powerful parsing library, was forbidden. Were all the Boost libraries similarly embargoed?

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

#36
post #29
post #10

Earlier quoted context omitted.

They probably wouldn't have been able to finish the project in time.

And a good professor would have flunked them for poor judgment.

My professor was definitely a good professor and no way they would have done that. It clearly would have been done as an added challenge for themselves for fun and there's no reason to penalize that.

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

#39
post #15

Where's the code? I scanned this article a few times and can't find a link to it.

None of it is open source because it was done for a school course that uses the same project every term. The only use for having access to the code would be cheating on that project. The school gets mad when people publish the source for their school projects, especially when it isn't otherwise useful, that's also why my ray tracer isn't open source.

I would not agree that that is the only use of that code. I’ve found a lot of school projects on GitHub when googling how to do stuff as a professional programmer and have found them useful quite often.

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

#40
post #35

I find it curious that both the team that used C++, and the author, both appear to believe that sum types and related facilities are not usable or conveniently expressible in C++. I got that Boost Spirit, a powerful parsing library, was forbidden. Were all the Boost libraries similarly embargoed?

There was a general prohibition on libraries that don't ship with the compiler, but you could ask the professor for an exception. Someone asked about Boost and a blanket exception for the non-parsing and scanning parts of Boost was granted. However the C++ team I talked to didn't use it.

Also note that it's not only the sum types that are important, powerful pattern matching facilities are part of what makes them so valuable.

Post reply on HN