Typescript's union types are really nice for writing interpreters.
type Value = NumberValue | StringValue;
function add(array<Value> args): NumberValue { ... }
I often find that primitive functions get little checking (e.g. just returning a Value) in the host language.
miniblog.
Related Posts
Implementation chicken:
When there's an obvious feature gap in an ecosystem and everyone is waiting for someone else to write it.
I see this most frequently with OSS toolchains. Basic functionality in new programming languages is another common scenario.
I'm debating whether `from foo import *` is a bad feature for my toy programming language.
Forcing `import foo as f` and later `f::bar()` is so much more amenable to local static analysis. You also don't get issues with name clashes.
It's certainly convenient though.
I've released difftastic 0.70! In this release:
* Added Dockerfile and fish shell support
* Improved Dart, Emacs Lisp, Erlang, Java, OCaml, PHP,
Protocol Buffers and TOML.
* A bunch of display and performance fixes.