Live data from Hacker News

Ask HN: Great programming language features, other languages should steal?

news.ycombinator.com

31–40 of 44 posts

Re: Ask HN: Great programming language features, other languages should steal?

#31

Every language should have robust, standard collections functions like Python does. Once you start doing quick things with lists like the zip function, or list comprehensions, it's hard to go back.

> Once you start doing quick things with lists like the zip function, or list comprehensions, it's hard to go back.

Totally agree with you on this one, but I'm not sure I'd go so far as to say that they're a defining feature of Python, more of functional languages, from which Python has borrowed a thing or two.

Re: Ask HN: Great programming language features, other languages should steal?

#32
post #31

Every language should have robust, standard collections functions like Python does. Once you start doing quick things with lists like the zip function, or list comprehensions, it's hard to go back.

> Once you start doing quick things with lists like the zip function, or list comprehensions, it's hard to go back. Totally agree with you on this one, but I'm not sure I'd go so far as to say that they're a defining feature of Python, more of functional languages, from which Python has borrowed a thing or two.

Agreed! Python is just one example of a language that does it well.

Re: Ask HN: Great programming language features, other languages should steal?

#33
post #25

It's more of a paradigm than a feature but, multiple dispatch à la Julia. One of the creators of Julia makes a strong case that it is the key to libraries that "compose" without being aware of one another: https://www.youtube.com/watch?v=kc9HwsxE1OY

They got that from lisp.

Julia compensates for time lost by making a lot more use of it in the stdlib than, say, most CL implementations do. It is as if the julia people saw it and went "wow, this is good!" and had it in from the beginning. With their focus on maths, it is hardly surprising.

Re: Ask HN: Great programming language features, other languages should steal?

#35
post #33

Earlier quoted context omitted.

They got that from lisp.

Julia compensates for time lost by making a lot more use of it in the stdlib than, say, most CL implementations do. It is as if the julia people saw it and went "wow, this is good!" and had it in from the beginning. With their focus on maths, it is hardly surprising.

There's actually a pretty fundamental reason that Julia's Base and stdlib makes more use of multiple dispatch than Common Lisp (or any other language in existence with multiple dispatch). It's that in basically every other language, multiple dispatch comes with a non-neglible performance penalty.

Julia's multiple dispatch semantics were designed around having a JIT compiler, and it's JIT compiler design was designed around having multiple dispatch, and this tight integration let us be really good at de-virtualizing the dispatch, removing the hefty performance pentalty.

This is why even basic arithmetic operations like +, * and whatnot are able to be generic functions (with a gigantic number of methods, 184 for + and 364 for * currently just in Base and LinearAlgebra!) without any runtime performance compromise.

By contrast, Nim for instance just removed multiple dispatch in their 1.0 release because nobody was using it due to being so slow.

Re: Ask HN: Great programming language features, other languages should steal?

#36
post #25

It's more of a paradigm than a feature but, multiple dispatch à la Julia. One of the creators of Julia makes a strong case that it is the key to libraries that "compose" without being aware of one another: https://www.youtube.com/watch?v=kc9HwsxE1OY

Multiple dispatch is a wonderful thing. It's basically what OOP should have been, rather than the horrible cludge of classes.

Re: Ask HN: Great programming language features, other languages should steal?

#37
post #33

Earlier quoted context omitted.

Julia compensates for time lost by making a lot more use of it in the stdlib than, say, most CL implementations do. It is as if the julia people saw it and went "wow, this is good!" and had it in from the beginning. With their focus on maths, it is hardly surprising.

There's actually a pretty fundamental reason that Julia's Base and stdlib makes more use of multiple dispatch than Common Lisp (or any other language in existence with multiple dispatch). It's that in basically every other language, multiple dispatch comes with a non-neglible performance penalty. Julia's multiple dispatch semantics were designed around having a JIT compiler, and it's JIT compiler design was designed…

Thanks! I always suspected you could have a fast dynamic dispatch in a typed language if you locked it down enough to not allow redefinitions at runtime and such (which removes a lot of the fun of CLOS). It makes sense to let the jit do the heavy lifting though!

Re: Ask HN: Great programming language features, other languages should steal?

#38
post #37

Earlier quoted context omitted.

There's actually a pretty fundamental reason that Julia's Base and stdlib makes more use of multiple dispatch than Common Lisp (or any other language in existence with multiple dispatch). It's that in basically every other language, multiple dispatch comes with a non-neglible performance penalty. Julia's multiple dispatch semantics were designed around having a JIT compiler, and it's JIT compiler design was designed…

Thanks! I always suspected you could have a fast dynamic dispatch in a typed language if you locked it down enough to not allow redefinitions at runtime and such (which removes a lot of the fun of CLOS). It makes sense to let the jit do the heavy lifting though!

Yes, Julia definitely had to make some dynamism restrictions that I suspect would dismay some lispers, but it is still a quite dynamic language. The language devs do some pretty clever things to have our cake and eat it too.

On the flip side, I think we have some dynamic metaprogramming magic of our own that might even impress some lispers such as IRTools.jl's dynamos or Cassette.jl's overdubing.

Re: Ask HN: Great programming language features, other languages should steal?

#39

Every language should have robust, standard collections functions like Python does. Once you start doing quick things with lists like the zip function, or list comprehensions, it's hard to go back.

Personally I think Ruby does a much nicer job of this, although I use both languages on a regular basis. A complx chain of map and filter calls tends to be a lot more readable than a complex nested list comprehension.

Re: Ask HN: Great programming language features, other languages should steal?

#40

Every language should have robust, standard collections functions like Python does. Once you start doing quick things with lists like the zip function, or list comprehensions, it's hard to go back.

Python collections doesn't have basic data structures like red black trees (which are in java as java.util.TreeMap or c++ as std::map). You end up needing third party libraries like sortedcontainers.
Post reply on HN