3 ms·
> I'd say that a dictionary is an ad-hoc, typeless instance. The dictionary will preserve the entirety of the data, that's already better than any custom type
by jeremiep 10y ago
> I'd say that a dictionary is an ad-hoc, typeless instance.
The dictionary will preserve the entirety of the data, that's already better than any custom type can ever dream to do. You're not going to want to upgrade your codebase every time a 3rd party adds fields to their documents.
Trying to make data "safe" by giving it strict types is only going to result in the destruction of data and no actual gains in safety.
> I prefer (no surprise!) the Lisp reader
The Lisp reader is not a data format nor is it available outside Lisp. That's no good on the wire unless you live in a sandbox and never talk to the real world.
You're going to receive data with fields/types your program do not understand (the endpoint could've pushed a new version without your knowledge) and there your ad-hoc types will become pain points.
Imagine if we tried to make HTTP "safe" by giving types to everything. The second a proxy sees a header it doesn't understand the request would fail. We'd have absolutely no internet. Distributed systems depend on the fact that you're able to handle unknown data and types.