Live data from Hacker News

Show HN: A SQL database implemented purely in TypeScript type annotations

github.com

21–30 of 196 posts

Re: Show HN: A SQL database implemented purely in TypeScript type annotations

#21
post #10

I had no idea you could compose string literal types AND infer variables using interpolation syntax in the context of conditional types. I am salivating at the potential use cases for this...

It's a new feature from TypeScript 4.1 (this version is yet in beta)

https://devblogs.microsoft.com/typescript/announcing-typescr...

Re: Show HN: A SQL database implemented purely in TypeScript type annotations

#23
TypeScript is becoming such a compelling language due to its insanely advanced type system (that allows for projects like this) that I now want to use it everywhere. I want it to become the next Python.

I know Deno is supposed to be first class TypeScript but under the hood it's still a JavaScript runtime with all the baggage that comes with that.

AssemblyScript is extremely interesting but last time I played with it I concluded it wasn't yet ready for anything serious, or is that no longer the case?

A first class TypeScript runtime with no JS overhead would be a dream come true. I just hope it happens someday, or that other type systems get these amazing features.

Re: Show HN: A SQL database implemented purely in TypeScript type annotations

#24
post #22

Could someone ELI5? Actually, I wrote a lot of code in TypeScript and I know my SQL but I have absolutely no idea what is going on here.

I'm not entirely sure, but I suspect it's one of these programming "joke" where you take a concept and bring it far enough that it becomes ridiculous.

So I'm guessing there's no real practical use case for this, and is a nice flex from the author.

It would be nice if that were made dead clear in the Readme, something like "Why? Because it's fun"

Re: Show HN: A SQL database implemented purely in TypeScript type annotations

#25
post #23

TypeScript is becoming such a compelling language due to its insanely advanced type system (that allows for projects like this) that I now want to use it everywhere. I want it to become the next Python. I know Deno is supposed to be first class TypeScript but under the hood it's still a JavaScript runtime with all the baggage that comes with that. AssemblyScript is extremely interesting but last time I played with it…

What do you mean by "no JS overhead"?

Re: Show HN: A SQL database implemented purely in TypeScript type annotations

#26
post #11

I’m impressed/fascinated/horrified by the way it parses a string into a type with a variant of template literal syntax—though it looks like the parsing is probably very fragile. I’m curious why that functionality was added to the language. The end result is actually pretty approachable.

it's a bit fragile only due to my laziness, it could be done properly if this were a serious project.

How would it be done if done properly?

Re: Show HN: A SQL database implemented purely in TypeScript type annotations

#28
post #22

Could someone ELI5? Actually, I wrote a lot of code in TypeScript and I know my SQL but I have absolutely no idea what is going on here.

I think this is an exploration of the somewhat surprising fact that type systems can be, and often are, Turing Complete[1]. A very naive view of type systems is that they're merely the next level up from code comments, except with the annoying burden of having the power to prevent compilation.

As this project demonstrates type systems are far more than just glorified comments. Indeed, they are in fact a rigorous scaffolding that seemingly magically "intuit" the intention of code without having to run it. This project playfully explores the extent of Typescript's particular powers.

1. https://en.wikipedia.org/wiki/Turing_completeness

Re: Show HN: A SQL database implemented purely in TypeScript type annotations

#29
post #23

TypeScript is becoming such a compelling language due to its insanely advanced type system (that allows for projects like this) that I now want to use it everywhere. I want it to become the next Python. I know Deno is supposed to be first class TypeScript but under the hood it's still a JavaScript runtime with all the baggage that comes with that. AssemblyScript is extremely interesting but last time I played with it…

What do you mean by "no JS overhead"?

Probably running raw TS not TS -> JS -> Compiler flow. Running TS directly will have lots of performance benefits. Compiler will know the types and can optimize better.
Post reply on HN