Hacker News new | ask | show | jobs
by recursive 2216 days ago
Static type safety is one difference.
1 comments

It'd be more accurate to say the illusion of type safety.

Under the hood many[0] ORMs simply construct a query similar to my example above and then convert result set of tabulated strings to the appropriate types (usually using reflection).

This means two things:

First, that the "type-safety" portions of an ORM are really located in the "mapping" code, so not really related to querying.

And second: you don't really have type safety. A database schema could change at any time and break the code even if static analysis seems to think it should work.

[0] Notable exceptions are languages that offer type providers (e.g. F#) but I digress

This particular illusion of safety actually provides some non-zero degree of safety. For instance, it prevents trivial typos in property names.