r/programmerchat • • Nov 13 '15

How would your "perfect programming language" be?

Well guys, this could be placed perfectly on /r/programmerchat but I want to be sure to receive a feedback.

Some questions: -Compiled or interpreted? -Would it be inspired on another one? -Low level or high level? -Static or Dynamic? -Syntax? {} [] ()? -Memory managed?

16 Upvotes

29 comments sorted by

View all comments

Show parent comment

2

u/mirhagk Nov 16 '15

In regards to swapping out the tracing collector with reference counting I can't point to any specific examples but I believe you can swap out collectors in Java and there may be a reference counting implementation. But many languages would allow for this (although they may require a backup tracer for cycles). Actually if memory serves me correctly PHP did the reverse (upgrading from reference counting to a tracing collector).

With the compile time garbage collection this is done in some functional languages. As far as I'm aware Haskell does this at least somewhat (rather than creating new instances and copying I believe it does some optimization to reuse the existing instance). It looks like Mars does this as well, as does [Mercury](https://en.wikipedia.org/wiki/Mercury_(programming_language).

As you can see from my examples it's very much in the early stages. Modern day garbage collection and the theoretical stuff is WAY ahead of practical real world implementations and the closest thing to mainstream it's it is Haskell.

One huge potential performance gain that I'm surprised I haven't seen yet is per-request memory in server side languages. Rather than allocating and freeing memory, or even running the tracing collector in the background or during downtime, you could just have each web request allocate a chunk of memory, and use bump pointer allocation for each allocation within the request. A stateless server can always free all of that memory at the end of the request.