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

I'm sorry but the source code is some of the most heinous JS I've ever read.

Classes that extend primitive types mixed in with function classes mixed in with 100 line ternary statements.



"Please don't post shallow dismissals, especially of other people's work. A good critical comment teaches us something."

https://news.ycombinator.com/newsguidelines.html


I think you should just keep a thing like this to yourself. It's attitudes like this that keeps people from daring to share their code with the world.

What you might find ugly, others find beautiful. I'm actually pretty proud of this lib, and i enjoy my style of coding. Your comment doesn't change that, it just kills a lot energy.


It’s the giant nested ternaries that kill me. In nearly all circumstances I can think of (Terraform being a notable exception), ternaries could be replaced with an if/else if block and be far more readable.

In my head I’m having to cast these to an if to figure it out anyway - why not just write it like that to begin with?


It's all about familiarity. To me ternaries gives me less ways in which the code can behave, so it takes less time to write, and less time to read. The obvious reason is that it's an expression and not a statement. So, the reason for me not writing it like this to begin with, is because I prefer ternaries over ifs. So much that i sometimes rewrite other code from ifs to ternaries to better grasp it. But that's me.


If you find it beautiful, who cares what I think?

You aren't writing this for public opinions, presumably.

I've also written a Postgres wire protocol implementation and a blog post on how to do so, which people are welcome to say "It's terrible" about if they wish.


Most people care to some degree what other people say about them / their work.

The fact that you've also dabbled in this area could lead to a far more interesting discussion. Wouldn't mind seeing your blog post. Who knows, maybe I've already read it at some point?

btw the reason for extending eg Array is to make for a much better surface API when using the library.

Being able to do const [user] = await sql`...` leads to some very readable concise code.


I find it beautiful, concise and very expressive.


Really deep analysis. Thanks!




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

Search: