
Ask HN: What programming language do you find the smartest and most efficient? - ned7
I use JavaScript and python regularly and I am willing to learn a new language that will increase my programming capabilities. What are some good suggestions and why?
======
jolmg
Haskell because of the type system. It's very satisfying to start a change in
one location and have the compiler automatically tell you all the other places
you need to modify across the whole project to finish the change and
practically guarantee that it runs correctly. It's also great to not have to
rely on human documentation to learn how to use a library. Looking at the type
signatures is enough to learn how to use most of them. The type system also
alleviates the need to write many tests.

It's also efficient in that it runs very, very fast thanks to being compiled.
The size of the compiled executables can be very small too, when you chose to
use dynamic linking of the libraries. Choosing static linking comes with the
advantage of not having to worry about installing library dependencies (beyond
libc) where-ever you chose to run the resulting executables.

------
DarkWiiPlayer
Lua. Its main selling points are that it's small, simple to embed and easy to
learn. You also won't find many interpreted languages that can even come close
to match its speed.

Also multiple returns. I find it hard to believe that nobody else thought of
that, but it's just not something any other language has.

~~~
jstewartmobile
Golang does multiple returns.

Can also accomplish the same in PHP by returning arrays and using list()
syntax as the lvalue.

~~~
Hamuko
How do Lua and Go differ from returning a tuple in Python?

~~~
jstewartmobile
# python, fn() returns tuple

    
    
       (college, student, type_ofcollege) = fn()
    

# php, fn() returns array

    
    
       list(college, student, type_ofcollege) = fn()
    

# go, fn() returns multiple values

    
    
       college, student, type_ofcollege := fn()
    

# lua, fn() returns multiple values

    
    
       college, student, type_ofcollege = fn()

------
jstewartmobile
As a skills exercise, I'd recommend pure-functional programming with immutable
data structures (clojure, elixir, etc). Getting to a point where you "own"
recursion and non-mutation will pay dividends in any language.

~~~
ned7
I was looking for that kind of answers,can you elaborate more, with some
practical examples, on the rewards someone can get from "mastering" a pure-
functional language?

~~~
jstewartmobile
Some solutions are easier to express recursively than iteratively--especially
in the graph/tree space. Filesystem? Tree. XML/JSON? Tree. Relational
database? Graph w/ underlying tree implementation. State machine? Graph.

As for immutability, consider how in languages like javascript, some mental
accounting has to take place over what is passed by reference, and what is
passed by value. Any error in this accounting can cause big problems. A pure-
functional approach really cuts that problem down to size. New values are
returned, and parameters are unchanged.

------
moksly
Python is easily the most efficient at getting things done at our shop. Not
sure it’s the smartest, but we care a lot less about that.

We were a C# shop for a long while, but even with .Net Core and a
Windows/azure heavy tech stack Python is just consistently better at getting
things into production.

Dynamic types aren’t always the greatest though.

------
catacombs
Golang is a good next step.

