> table.getOrDefault(1, createAString("ONE!")) will ALWAYS invoke > createAString, even if not needed. It would be useful to have this only > execute when necessary.
You want call-by-name. Alternatively, you could wrap it into a closure. But then, the callee has to know that it has to call the passed closure value. Generally, you can't reproduce CBN with call-by-value languages. It is always a hack.