Topics /

Programming Languages

The most popular blog posts about programming languages on Hacker News. 5,634 posts.

Any year
4839

Types as axioms, or: playing god with static types

A common perspective is that types are restrictions . Static types restrict the set of values a variable may contain, capturing some subset of the space of “all possible values.” Under this worldview, a typechecker is sort of like an oracle, predicting which values will end up where when the program runs and making…

4842

Algebraic effects, ownership, and borrowing

Algebraic Effects are a useful abstraction for reasoning about effectful programs by letting us leave the interpretation of these effects to callers. However, most existing literature discusses these in the context of a pure functional language with pervasive sharing of values. What restrictions would we need to…

4843

Ruby Fiber Scheduler

Ruby can work asynchronously with just a Fiber Scheduler and a couple built-in methods - no frameworks are required! It's easy to use, scales well, and has amazing performance benefits.

4846

Tuning Ruby's Global Method Cache

I was recently profiling a production Shopify application server using perf and noticed a fair amount of time being spent in a particular function, st_lookup, which is used by Ruby’s MRI implementation for hash table lookups: Hash tables are used all over MRI, and not just for the Hash object; global variables…

4848

Defeating Racket’s separate compilation guarantee

Being a self-described programming-language programming language is an ambitious goal. To preserve predictability while permitting linguistic extension, Racket comes equipped with a module system carefully designed to accommodate composable and compilable macros . One of the module system’s foundational properties is…

4856

`std::flip`

std::flip is a little-known utility from the C++ standard library header <functional>: it is a higher-order function that accepts a Callable and returns an equivalent Callable with the order of its parameters reversed (or “flipped”).

4857

Contracts for C

C++ seems to finally converge with their contracts proposal, I decided to give it a try and come up with ideas how such a thing would look for C. This is in early stages, not a full proposal yet, a…

4859

Performance Analysis of Python's Dict() and {}

Some time ago, during a code review, I had a discussion with a colleague of mine about preferring dict() over {} in new Python code. They argued that dict() is more readable — and expresses intent more clearly — therefore should be preferred. I wasn’t convinced by that, but at that time I didn’t have any…