Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Isn't this what an ORM does? You write "User.findOne(user => user.name == "Glauber Costa" && user.age >= 40);" and it will be translated into SQL. Maybe I'm missing something here, but I don't see the innovation.


Remember, that argument to `findOne()` is an arrow function. You need a compiler to turn it into a efficient, deferred query; otherwise you need to _evaluate_ the function at runtime.


This is the disconnect I've found in my self-taught compiler education journey. Every time I try to tackle this topic, I get bogged down by parsers and lexers. I already have that structure.

Users.find(x => x.name == "Bob").

My programming language has done that for me. What's the next phase? What data structures do I need to maintain to construct these DSLs? How do I optimize them?

I can fight my way through this but I wish I just had the theory and making this kind of stuff easier. It just comes up so often in the problems that I solve and I'd like to reach for this tool more often.


Perhaps you are looking for macros? Rust had a substantial macro system while being low-level enough to fit into most architectures. I haven’t implemented a macro but I’ve used many. Have you looked there?


As I was writing my comment, I think maybe I should start with DSL, but this isn't conclusive. Spark, Scalding, LINQ, RxJava, even Slick are examples of the types of DSLs I'd like to understand how to construct. They're essentially compilers.

Looking at the code for these technologies it's incredible how complex it is to implement the nice DSL that they expose. How much of that is accidental complexity?


So the innovation here is instead of doing "User.findOne({name: "Glauber Costa", age: {superiorOrEqual: 40}});" you do what's in my previous comment?




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

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

Search: