Hacker News new | past | comments | ask | show | jobs | submit login

Maybe we should treat SQL like JavaScript, and use it as a compiler target instead of coding in it directly. /s



Not sure why you added /s; .. SQL is in many ways exactly lile JavaScript. The only way to run your code where it needs to run, but with some things to be desired language wise.

I wish more languages compiling to SQL were more common.

(Not ORMs though they just miss the point entirely..)


I mean, that's pretty much what ORMs do, right? Hasura et al too.


Yes, this is true. Although my experience with ORMs is that there is always a reason to use some kind of escape hatch to run raw SQL directly.


Agreed. After spending the better part of a decade watching Hibernate a) fail to scale or b) get confused beyond a third level of association, I find myself writing bare SQL and/or refactoring to implement the repository model. ORMs are great for prototyping or if your data model is simple; beyond that you're better off without them.


Most higher level regular programming languages will allow you to escape to C, and C allows you to escape to assembly, so that's not unusual.

In my experience when you need to escape to raw SQL there is still some kind of query builder employed, which too becomes another "compile to SQL" source.


I know you're being sarcastic, but yes!




Consider applying for YC's Fall 2025 batch! Applications are open till Aug 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: