Every story and comment from the Hacker News API, in a layout borrowed from 2001.
A comment on Why I love Smalltalk. Parent comment
It uses dynamic binding.
In Java it would look like something this (but it's less useful without proper closures):
abstract class Bool { void ifTrue(Runnable f, Runnable g); } class True extends Bool { void ifTrue(Function f, Function g) { f.run(); } } class False extends Bool { void ifTrue(Function f, Function g) { g.run(); } }
Bool b;
b.ifTrue(new Runnable() { public void run() { System.out.println("It's true!"); } } , new Runnable() { public void run() { System.out.println("Not true!"); } } );
It uses dynamic binding.
In Java it would look like something this (but it's less useful without proper closures):
Then, given a variable the if-then-else becomes It's a bit more verbose, though...