Hacker News new | ask | show | jobs
by Smaug123 1691 days ago
> Give me an API that takes a key/value pair where key is the name of the field to be set, and value is the value to be set.

Not in a statically typed language, please! It should be a compile-time error to try and set the key `Kye`.

1 comments

I agree with the compile-time error checking part, but it's possible to have groups of key/value pairs (i.e. anonymous records) in a statically typed language where only specific keys are allowed, with specific value types for each key.